summaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorSimon Riggs2017-04-06 12:31:52 +0000
committerSimon Riggs2017-04-06 12:31:52 +0000
commit6bad580d9e678a0b604883e14d8401d469b06566 (patch)
tree44630ef43002b029704432f405ae2949081eb841 /src/backend/access
parentfd01983594b7d2119653428e3b532578008c7065 (diff)
Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
For normal commits and aborts we already reset PgXact->xmin, so we can simply avoid running SnapshotResetXmin() twice. During performance tests by Alexander Korotkov, diagnosis by Andres Freund showed PgXact array as a bottleneck. After manual analysis by me of the code paths that touch those memory locations, I was able to identify extraneous code in the main transaction commit path. Avoiding touching highly contented shmem improves concurrent performance slightly on all workloads, confirmed by tests run by Ashutosh Sharma and Alexander Korotkov. Simon Riggs Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/transam/xact.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 6f614e4fad0..84409ea9562 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2137,7 +2137,7 @@ CommitTransaction(void)
AtEOXact_ComboCid();
AtEOXact_HashTables(true);
AtEOXact_PgStat(true);
- AtEOXact_Snapshot(true);
+ AtEOXact_Snapshot(true, false);
AtCommit_ApplyLauncher();
pgstat_report_xact_timestamp(0);
@@ -2409,7 +2409,7 @@ PrepareTransaction(void)
AtEOXact_ComboCid();
AtEOXact_HashTables(true);
/* don't call AtEOXact_PgStat here; we fixed pgstat state above */
- AtEOXact_Snapshot(true);
+ AtEOXact_Snapshot(true, true);
pgstat_report_xact_timestamp(0);
CurrentResourceOwner = NULL;
@@ -2640,7 +2640,7 @@ CleanupTransaction(void)
* do abort cleanup processing
*/
AtCleanup_Portals(); /* now safe to release portal memory */
- AtEOXact_Snapshot(false); /* and release the transaction's snapshots */
+ AtEOXact_Snapshot(false, false); /* and release the transaction's snapshots */
CurrentResourceOwner = NULL; /* and resource owner */
if (TopTransactionResourceOwner)