diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2024-04-16 13:14:20 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2024-04-16 13:14:20 +0300 |
commit | 6377e12a5a5278446bb0d215439b4825ef8996d1 (patch) | |
tree | 219f016bf3f9c8ac2d5b1ac95db4e7876898105d /src/backend/access | |
parent | bea97cd02ebb347ab469b78673c2b33a72109669 (diff) | |
download | postgresql-6377e12a5a5278446bb0d215439b4825ef8996d1.tar.gz postgresql-6377e12a5a5278446bb0d215439b4825ef8996d1.zip |
revert: Generalize relation analyze in table AM interface
This commit reverts 27bc1772fc and dd1f6b0c17. Per review by Andres Freund.
Discussion: https://postgr.es/m/20240415201057.khoyxbwwxfgzomeo%40awork3.anarazel.de
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 29 | ||||
-rw-r--r-- | src/backend/access/table/tableamapi.c | 2 |
2 files changed, 6 insertions, 25 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 3428d80817c..6f8b1b79298 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -1002,7 +1002,7 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap, * until heapam_scan_analyze_next_tuple() returns false. That is until all the * items of the heap page are analyzed. */ -bool +static bool heapam_scan_analyze_next_block(TableScanDesc scan, ReadStream *stream) { HeapScanDesc hscan = (HeapScanDesc) scan; @@ -1026,17 +1026,7 @@ heapam_scan_analyze_next_block(TableScanDesc scan, ReadStream *stream) return true; } -/* - * Iterate over tuples in the block selected with - * heapam_scan_analyze_next_block(). If a tuple that's suitable for sampling - * is found, true is returned and a tuple is stored in `slot`. When no more - * tuples for sampling, false is returned and the pin and lock acquired by - * heapam_scan_analyze_next_block() are released. - * - * *liverows and *deadrows are incremented according to the encountered - * tuples. - */ -bool +static bool heapam_scan_analyze_next_tuple(TableScanDesc scan, TransactionId OldestXmin, double *liverows, double *deadrows, TupleTableSlot *slot) @@ -2593,18 +2583,6 @@ SampleHeapTupleVisible(TableScanDesc scan, Buffer buffer, } } -/* - * heapap_analyze -- implementation of relation_analyze() for heap - * table access method - */ -static void -heapam_analyze(Relation relation, AcquireSampleRowsFunc *func, - BlockNumber *totalpages, BufferAccessStrategy bstrategy) -{ - block_level_table_analyze(relation, func, totalpages, bstrategy, - heapam_scan_analyze_next_block, - heapam_scan_analyze_next_tuple); -} /* ------------------------------------------------------------------------ * Definition of the heap table access method. @@ -2652,9 +2630,10 @@ static const TableAmRoutine heapam_methods = { .relation_copy_data = heapam_relation_copy_data, .relation_copy_for_cluster = heapam_relation_copy_for_cluster, .relation_vacuum = heap_vacuum_rel, + .scan_analyze_next_block = heapam_scan_analyze_next_block, + .scan_analyze_next_tuple = heapam_scan_analyze_next_tuple, .index_build_range_scan = heapam_index_build_range_scan, .index_validate_scan = heapam_index_validate_scan, - .relation_analyze = heapam_analyze, .relation_size = table_block_relation_size, .relation_needs_toast_table = heapam_relation_needs_toast_table, diff --git a/src/backend/access/table/tableamapi.c b/src/backend/access/table/tableamapi.c index 55b8caeadf2..ce637a5a5d9 100644 --- a/src/backend/access/table/tableamapi.c +++ b/src/backend/access/table/tableamapi.c @@ -81,6 +81,8 @@ GetTableAmRoutine(Oid amhandler) Assert(routine->relation_copy_data != NULL); Assert(routine->relation_copy_for_cluster != NULL); Assert(routine->relation_vacuum != NULL); + Assert(routine->scan_analyze_next_block != NULL); + Assert(routine->scan_analyze_next_tuple != NULL); Assert(routine->index_build_range_scan != NULL); Assert(routine->index_validate_scan != NULL); |