diff options
| author | Tom Lane | 2020-09-01 22:37:12 +0000 |
|---|---|---|
| committer | Tom Lane | 2020-09-01 22:40:43 +0000 |
| commit | a7212be8b9e0885ee769e8c55f99ef742cda487b (patch) | |
| tree | a0cb039b58cd2557725f63a2e60daf5392df3ffe /src/include/commands | |
| parent | db864c3c36035e4620afd114c783af7d777d78b0 (diff) | |
Set cutoff xmin more aggressively when vacuuming a temporary table.
Since other sessions aren't allowed to look into a temporary table
of our own session, we do not need to worry about the global xmin
horizon when setting the vacuum XID cutoff. Indeed, if we're not
inside a transaction block, we may set oldestXmin to be the next
XID, because there cannot be any in-doubt tuples in a temp table,
nor any tuples that are dead but still visible to some snapshot of
our transaction. (VACUUM, of course, is never inside a transaction
block; but we need to test that because CLUSTER shares the same code.)
This approach allows us to always clean out a temp table completely
during VACUUM, independently of concurrent activity. Aside from
being useful in its own right, that simplifies building reproducible
test cases.
Discussion: https://postgr.es/m/3490536.1598629609@sss.pgh.pa.us
Diffstat (limited to 'src/include/commands')
| -rw-r--r-- | src/include/commands/cluster.h | 3 | ||||
| -rw-r--r-- | src/include/commands/vacuum.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h index e05884781b9..1eb144204b6 100644 --- a/src/include/commands/cluster.h +++ b/src/include/commands/cluster.h @@ -19,7 +19,8 @@ extern void cluster(ClusterStmt *stmt, bool isTopLevel); -extern void cluster_rel(Oid tableOid, Oid indexOid, int options); +extern void cluster_rel(Oid tableOid, Oid indexOid, int options, + bool isTopLevel); extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode); extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal); diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index a4cd7214009..d9475c99890 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -267,6 +267,7 @@ extern void vacuum_set_xid_limits(Relation rel, int freeze_min_age, int freeze_table_age, int multixact_freeze_min_age, int multixact_freeze_table_age, + bool isTopLevel, TransactionId *oldestXmin, TransactionId *freezeLimit, TransactionId *xidFullScanLimit, |
