Re: Much Ado About COUNT(*)

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: "Jonah H. Harris" <jharris@tvi.edu>, pgsql-hackers@postgresql.org
Date: 2005-01-13T15:29:16Z
Lists: pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> The ugly part of this is that clearing the bit is not like setting a
>> hint bit, ie it's not okay if we lose that change.  Therefore, each
>> bit-clearing would have to be WAL-logged.  This is a big part of my
>> concern about the cost.

> Yep, that was my concern too.  My feeling is that once you mark the
> tuple for expiration (update/delete), you then clear the index bit. 
> When reading WAL on recovery, you have to clear index bits on rows as
> you read expire information from WAL.  I don't think it would require
> extra WAL information.

Wrong.  The WAL recovery environment is not capable of executing
arbitrary user-defined functions, therefore it cannot compute index
entries on its own.  The *only* way we can do this is if the WAL record
stream tells exactly what to do and which physical tuple to do it to.

			regards, tom lane