Thread: pgsql: Generalize relation analyze in table AM interface
Generalize relation analyze in table AM interface Currently, there is just one algorithm for sampling tuples from a table written in acquire_sample_rows(). Custom table AM can just redefine the way to get the next block/tuple by implementing scan_analyze_next_block() and scan_analyze_next_tuple() API functions. This approach doesn't seem general enough. For instance, it's unclear how to sample this way index-organized tables. This commit allows table AM to encapsulate the whole sampling algorithm (currently implemented in acquire_sample_rows()) into the relation_analyze() API function. Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com Reviewed-by: Pavel Borisov, Matthias van de Meent Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/27bc1772fc814946918a5ac8ccb9b5c5ad0380aa Modified Files -------------- src/backend/access/heap/heapam_handler.c | 29 ++++++--- src/backend/access/table/tableamapi.c | 2 - src/backend/commands/analyze.c | 54 ++++++++-------- src/include/access/heapam.h | 9 +++ src/include/access/tableam.h | 106 +++++++------------------------ src/include/commands/vacuum.h | 19 ++++++ src/include/foreign/fdwapi.h | 6 +- 7 files changed, 100 insertions(+), 125 deletions(-)