From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Jonah H(dot) Harris" <jharris(at)tvi(dot)edu>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Much Ado About COUNT(*) |
Date: | 2005-01-13 14:04:46 |
Message-ID: | 200501131404.j0DE4kd03279@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-announce pgsql-hackers pgsql-patches |
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> Ah, right, I missed the connection. Hmm ... that's sort of the inverse
> >> of the "killed tuple" optimization we put in a release or two back,
> >> where an index tuple is marked as definitely dead once it's committed
> >> dead and the deletion is older than all active transactions.
>
> > Yes, it is sort of the reverse, but how do you get around the delete
> > case?
>
> A would-be deleter of a tuple would have to go and clear the "known
> good" bits on all the tuple's index entries before it could commit.
> This would bring the tuple back into the "uncertain status" condition
> where backends would have to visit the heap to find out what's up.
> Eventually the state would become certain again (either dead to
> everyone or live to everyone) and one or the other hint bit could be
> set again.
Right. Do you think the extra overhead of clearing those bits on
update/delete would be worth it?
> 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.
The net effect of this idea is that indexes have to look up heap row
status information only for rows that have been recently
created/expired.
If we did have those bits, it would allow us to read data directly from
the index, which is something we don't do now.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-01-13 15:29:16 | Re: Much Ado About COUNT(*) |
Previous Message | Christopher Kings-Lynne | 2005-01-13 10:12:49 | Re: Much Ado About COUNT(*) |
From | Date | Subject | |
---|---|---|---|
Next Message | Csaba Nagy | 2005-01-13 14:48:51 | Re: [HACKERS] Much Ado About COUNT(*) |
Previous Message | Greg Stark | 2005-01-13 13:59:31 | Re: [HACKERS] Much Ado About COUNT(*) |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-01-13 15:29:16 | Re: Much Ado About COUNT(*) |
Previous Message | Christopher Kings-Lynne | 2005-01-13 10:12:49 | Re: Much Ado About COUNT(*) |