On 8/15/07, Bruce Momjian <[EMAIL PROTECTED]> 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org