1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

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
This commit is contained in:
Alexander Korotkov
2024-04-08 14:30:30 +03:00
parent df64c81ca9
commit dd1f6b0c17
5 changed files with 106 additions and 19 deletions

View File

@@ -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.