
> I am looking at adding an index tuple flag to indicate when a 
> heap tuple is expired so the index code can skip looking up the heap tuple.
> 
> The problem is that I can't figure out how be sure that the heap tuple
> doesn't need to be looked at by _any_ backend.  Right now, we update the
> transaction commit flags in the heap tuple to prevent a pg_log lookup,
> but that is not enough because some transactions may still see that heap
> tuple as visible.

If you are only marking those, that need not be visible anymore, can you not
simply delete that key (slot) from the index ? I know vacuum then shows a count 
mismatch, but that could probably be accounted for.

Andreas

Fri, 18 May 2001 08:26:43 +0200
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at>
AW: Adding index flag showing tuple status
>> I am looking at adding an index tuple flag to indicate when a 
>> heap tuple is expired so the index code can skip looking up the heap tuple.
>> 
>> The problem is that I can't figure out how be sure that the heap tuple
>> doesn't need to be looked at by _any_ backend.  Right now, we update the
>> transaction commit flags in the heap tuple to prevent a pg_log lookup,
>> but that is not enough because some transactions may still see that heap
>> tuple as visible.

> If you are only marking those, that need not be visible anymore, can you not
> simply delete that key (slot) from the index ? I know vacuum then shows a count 
> mismatch, but that could probably be accounted for.

I am not sure we need this, if we implement a lightweight VACUUM per my
proposal in a nearby thread.  The conditions that you could mark or
delete an index tuple under are exactly the same that VACUUM would be
looking for (viz, tuple dead as far as all remaining transactions are
concerned).

			regards, tom lane

Fri, 18 May 2001 03:17:21 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: AW: Adding index flag showing tuple status 
[ Charset ISO-8859-1 unsupported, converting... ]
> 
> > I am looking at adding an index tuple flag to indicate when a 
> > heap tuple is expired so the index code can skip looking up the heap tuple.
> > 
> > The problem is that I can't figure out how be sure that the heap tuple
> > doesn't need to be looked at by _any_ backend.  Right now, we update the
> > transaction commit flags in the heap tuple to prevent a pg_log lookup,
> > but that is not enough because some transactions may still see that heap
> > tuple as visible.
> 
> If you are only marking those, that need not be visible anymore, can you not
> simply delete that key (slot) from the index ? I know vacuum then shows a count 
> mismatch, but that could probably be accounted for.

I wasn't going to delete it, just add a flag to index scans know they
don't need to look at the heap table.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Fri, 18 May 2001 10:59:37 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: AW: Adding index flag showing tuple status