Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1cf693a

Browse files
committed
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. Thereis no need to check it against snapshot xmax in that case.
1 parent205b5c2 commit1cf693a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎src/backend/utils/time/tqual.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Portions Copyright (c) 1994, Regents of the University of California
1717
*
1818
* IDENTIFICATION
19-
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.49 2002/01/16 23:51:56 tgl Exp $
19+
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.50 2002/05/06 02:39:01 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -707,13 +707,12 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
707707
* By here, the inserting transaction has committed - have to check
708708
* when...
709709
*/
710-
711-
if (TransactionIdFollowsOrEquals(tuple->t_xmin,snapshot->xmax))
712-
return false;
713710
if (TransactionIdFollowsOrEquals(tuple->t_xmin,snapshot->xmin))
714711
{
715712
uint32i;
716713

714+
if (TransactionIdFollowsOrEquals(tuple->t_xmin,snapshot->xmax))
715+
return false;
717716
for (i=0;i<snapshot->xcnt;i++)
718717
{
719718
if (TransactionIdEquals(tuple->t_xmin,snapshot->xip[i]))
@@ -748,12 +747,15 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
748747
tuple->t_infomask |=HEAP_XMAX_COMMITTED;
749748
}
750749

751-
if (TransactionIdFollowsOrEquals(tuple->t_xmax,snapshot->xmax))
752-
return true;
750+
/*
751+
* OK, the deleting transaction committed too ... but when?
752+
*/
753753
if (TransactionIdFollowsOrEquals(tuple->t_xmax,snapshot->xmin))
754754
{
755755
uint32i;
756756

757+
if (TransactionIdFollowsOrEquals(tuple->t_xmax,snapshot->xmax))
758+
return true;
757759
for (i=0;i<snapshot->xcnt;i++)
758760
{
759761
if (TransactionIdEquals(tuple->t_xmax,snapshot->xip[i]))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp