aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/valid.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-11-26 03:03:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-11-26 03:03:07 +0000
commit70f1482de3dd797eeee6093210c716115c38795b (patch)
tree781172ccd2c151515682c6157a89758bee73d021 /src/include/access/valid.h
parent290166f93404d8759f4bf60ef1732c8ba9a52785 (diff)
downloadpostgresql-70f1482de3dd797eeee6093210c716115c38795b.tar.gz
postgresql-70f1482de3dd797eeee6093210c716115c38795b.zip
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.
Diffstat (limited to 'src/include/access/valid.h')
-rw-r--r--src/include/access/valid.h35
1 files changed, 1 insertions, 34 deletions
diff --git a/src/include/access/valid.h b/src/include/access/valid.h
index 8309c699178..cb9c6369a12 100644
--- a/src/include/access/valid.h
+++ b/src/include/access/valid.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/valid.h,v 1.36 2004/12/31 22:03:21 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/access/valid.h,v 1.37 2005/11/26 03:03:07 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,37 +65,4 @@ do \
} \
} while (0)
-/*
- * HeapTupleSatisfies
- *
- * res is set TRUE if the HeapTuple satisfies the timequal and keytest,
- * otherwise it is set FALSE. Note that the hint bits in the HeapTuple's
- * t_infomask may be updated as a side effect.
- *
- * on 8/21/92 mao says: i rearranged the tests here to do keytest before
- * SatisfiesTimeQual. profiling indicated that even for vacuumed relations,
- * time qual checking was more expensive than key testing. time qual is
- * least likely to fail, too. we should really add the time qual test to
- * the restriction and optimize it in the normal way. this has interactions
- * with joey's expensive function work.
- */
-#define HeapTupleSatisfies(tuple, \
- relation, \
- buffer, \
- disk_page, \
- snapshot, \
- nKeys, \
- key, \
- res) \
-do \
-{ \
- if ((key) != NULL) \
- HeapKeyTest(tuple, RelationGetDescr(relation), nKeys, key, res); \
- else \
- (res) = true; \
- \
- if ((res) && (relation)->rd_rel->relkind != RELKIND_UNCATALOGED) \
- (res) = HeapTupleSatisfiesVisibility(tuple, snapshot, buffer); \
-} while (0)
-
#endif /* VALID_H */