Change seqscan logic so that we check visibility of all tuples on a page
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Nov 2005 03:03:07 +0000 (03:03 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 26 Nov 2005 03:03:07 +0000 (03:03 +0000)
commit70f1482de3dd797eeee6093210c716115c38795b
tree781172ccd2c151515682c6157a89758bee73d021
parent290166f93404d8759f4bf60ef1732c8ba9a52785
Change seqscan logic so that we check visibility of all tuples on a page
when we first read the page, rather than checking them one at a time.
This allows us to take and release the buffer content lock just once
per page, instead of once per tuple.  Since it's a shared lock the
contention penalty for holding the lock longer shouldn't be too bad.
We can safely do this only when using an MVCC snapshot; else the
assumption that visibility won't change over time is uncool.  Therefore
there are now two code paths depending on the snapshot type.  I also
made the same change in nodeBitmapHeapscan.c, where it can be done always
because we only support MVCC snapshots for bitmap scans anyway.
Also make some incidental cleanups in the APIs of these functions.
Per a suggestion from Qingqing Zhou.
src/backend/access/heap/heapam.c
src/backend/executor/nodeBitmapHeapscan.c
src/include/access/relscan.h
src/include/access/valid.h
src/include/nodes/execnodes.h
src/include/utils/tqual.h