summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2023-01-03 11:22:36 -0800
committerPeter Geoghegan <pg@bowt.ie>2023-01-03 11:22:36 -0800
commit79d4bf4eff14d8967b10ad4c60039c1b9b0cf66e (patch)
treeb4487781454b36f54d66d4bd76ba3f970c5e54fb /src/include/access
parentb37a0832396414e8469d4ee4daea33396bde39b0 (diff)
Delay commit status checks until freezing executes.
pg_xact lookups are relatively expensive. Move the xmin/xmax commit status checks from the point that freeze plans are prepared to the point that they're actually executed. Otherwise we'll repeat many commit status checks whenever multiple successive VACUUM operations scan the same pages and decide against freezing each time, which is a waste of cycles. Oversight in commit 1de58df4, which added page-level freezing. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-WzkZpe4K6qMfEt8H4qYJCKc2R7TPvKsBva7jc9w7iGXQSw@mail.gmail.com
Diffstat (limited to 'src/include/access')
-rw-r--r--src/include/access/heapam.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 4a69b6dd043..417108f1e01 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -100,6 +100,13 @@ typedef enum
HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */
} HTSV_Result;
+/*
+ * heap_prepare_freeze_tuple may request that heap_freeze_execute_prepared
+ * check any tuple's to-be-frozen xmin and/or xmax status using pg_xact
+ */
+#define HEAP_FREEZE_CHECK_XMIN_COMMITTED 0x01
+#define HEAP_FREEZE_CHECK_XMAX_ABORTED 0x02
+
/* heap_prepare_freeze_tuple state describing how to freeze a tuple */
typedef struct HeapTupleFreeze
{
@@ -109,6 +116,8 @@ typedef struct HeapTupleFreeze
uint16 t_infomask;
uint8 frzflags;
+ /* xmin/xmax check flags */
+ uint8 checkflags;
/* Page offset number for tuple */
OffsetNumber offset;
} HeapTupleFreeze;