Re: Another idea for index-only scans

From: "Mike Rylander" <mrylander(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Another idea for index-only scans
Date: 2007-08-15 17:54:46
Message-ID: b918cf3d0708151054o5e634265ta3968b20977981d2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/15/07, Bruce Momjian <bruce(at)momjian(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-08-15 17:54:58 Re: XID wraparound and busy databases
Previous Message Jeff Davis 2007-08-15 17:41:08 Re: Index Tuple Compression Approach?