pgsql: Generalize relation analyze in table AM interface

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Generalize relation analyze in table AM interface
Date: 2024-03-30 20:54:54
Message-ID: E1rqfj4-006YS4-Hj@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message John Naylor 2024-03-31 05:32:46 pgsql: Speed up tail processing when hashing aligned C strings
Previous Message Tom Lane 2024-03-30 17:57:24 pgsql: Add pg_basetype() function to extract a domain's base type.