Thread: pgsql: Change seqscan logic so that we check visibility of all tuples on

pgsql: Change seqscan logic so that we check visibility of all tuples on

From
tgl@svr1.postgresql.org (Tom Lane)
Date:
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/src/backend/access/heap:
        heapam.c (r1.203 -> r1.204)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/heap/heapam.c.diff?r1=1.203&r2=1.204)
    pgsql/src/backend/executor:
        nodeBitmapHeapscan.c (r1.5 -> r1.6)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeBitmapHeapscan.c.diff?r1=1.5&r2=1.6)
    pgsql/src/include/access:
        relscan.h (r1.41 -> r1.42)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/relscan.h.diff?r1=1.41&r2=1.42)
        valid.h (r1.36 -> r1.37)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/valid.h.diff?r1=1.36&r2=1.37)
    pgsql/src/include/nodes:
        execnodes.h (r1.142 -> r1.143)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h.diff?r1=1.142&r2=1.143)
    pgsql/src/include/utils:
        tqual.h (r1.59 -> r1.60)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/tqual.h.diff?r1=1.59&r2=1.60)