Re: Another idea for index-only scans - Mailing list pgsql-hackers

From Mike Rylander
Subject Re: Another idea for index-only scans
Date
Msg-id b918cf3d0708151054o5e634265ta3968b20977981d2@mail.gmail.com
Whole thread Raw
In response to Another idea for index-only scans  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On 8/15/07, Bruce Momjian <bruce@momjian.us> wrote:
> I have added another idea for index-only scans to the TODO list:
>
> >   A third idea would be for a heap scan to check if all rows are visible
> >   and if so set a per-table flag which can be checked by index scans.
> >   Any change to the table would have to clear the flag.  To detect
> >   changes during the heap scan a counter could be set at the start and
> >   checked at the end --- if it is the same, the table has not been
> >   modified --- any table change would increment the counter.

Perhaps this is naive (or discussed and discarded... if so, I couldn't
find it, but I apologize if that's the case), but wouldn't recording
the xid of non-readonly transactions, at commit time, and at the table
level, be equivalent to the flag and remove the need for a counter?
Readers could just check the last-modification-xid at the beginning
and end of their scans to test for heap stability.

I suppose that would require a write-exclusive lock on some metadata
for each modified table during each commit... so perhaps it's a
non-starter right there.

--miker


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: XID wraparound and busy databases
Next
From: Darcy Buskermolen
Date:
Subject: Re: XID wraparound and busy databases