diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2024-04-08 14:30:30 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2024-04-08 14:39:48 +0300 |
commit | dd1f6b0c172a643a73d6b71259fa2d10378b39eb (patch) | |
tree | 9c08767689111b896cc1d259c4bf2786b15fabba /src/backend/access/heap/heapam_handler.c | |
parent | df64c81ca9cba7b0fcb0ded5f735e99e676671c1 (diff) | |
download | postgresql-dd1f6b0c172a643a73d6b71259fa2d10378b39eb.tar.gz postgresql-dd1f6b0c172a643a73d6b71259fa2d10378b39eb.zip |
Provide a way block-level table AMs could re-use acquire_sample_rows()
While keeping API the same, this commit provides a way for block-level table
AMs to re-use existing acquire_sample_rows() by providing custom callbacks
for getting the next block and the next tuple.
Reported-by: Andres Freund
Discussion: https://postgr.es/m/20240407214001.jgpg5q3yv33ve6y3%40awork3.anarazel.de
Reviewed-by: Pavel Borisov
Diffstat (limited to 'src/backend/access/heap/heapam_handler.c')
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 6b1d2dd7a48..30095d88b09 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -2666,6 +2666,18 @@ 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. |