aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-05-06 02:39:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-05-06 02:39:01 +0000
commit1cf693ab86b3c3952b441de5f57d9a9e0a925b12 (patch)
tree1c3f6b1d9ddba6cebb74155e46fb52db1716df75 /src
parent205b5c2f4bebfeced12a0fb1664c289ffabda258 (diff)
downloadpostgresql-1cf693ab86b3c3952b441de5f57d9a9e0a925b12.tar.gz
postgresql-1cf693ab86b3c3952b441de5f57d9a9e0a925b12.zip
Reorder snapshot checks to save a couple comparisons in the common case,
where the tuple's xmin or xmax is older than the snapshot xmin. There is no need to check it against snapshot xmax in that case.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/time/tqual.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index ac06d91dc48..ba052e5f77b 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -16,7 +16,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.49 2002/01/16 23:51:56 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.50 2002/05/06 02:39:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -707,13 +707,12 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
* By here, the inserting transaction has committed - have to check
* when...
*/
-
- if (TransactionIdFollowsOrEquals(tuple->t_xmin, snapshot->xmax))
- return false;
if (TransactionIdFollowsOrEquals(tuple->t_xmin, snapshot->xmin))
{
uint32 i;
+ if (TransactionIdFollowsOrEquals(tuple->t_xmin, snapshot->xmax))
+ return false;
for (i = 0; i < snapshot->xcnt; i++)
{
if (TransactionIdEquals(tuple->t_xmin, snapshot->xip[i]))
@@ -748,12 +747,15 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
tuple->t_infomask |= HEAP_XMAX_COMMITTED;
}
- if (TransactionIdFollowsOrEquals(tuple->t_xmax, snapshot->xmax))
- return true;
+ /*
+ * OK, the deleting transaction committed too ... but when?
+ */
if (TransactionIdFollowsOrEquals(tuple->t_xmax, snapshot->xmin))
{
uint32 i;
+ if (TransactionIdFollowsOrEquals(tuple->t_xmax, snapshot->xmax))
+ return true;
for (i = 0; i < snapshot->xcnt; i++)
{
if (TransactionIdEquals(tuple->t_xmax, snapshot->xip[i]))