pgsql: tableam: sample scan. - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: tableam: sample scan.
Date
Msg-id E1hAlxl-0001xr-DK@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
tableam: sample scan.

This moves sample scan support to below tableam. It's not optional as
there is, in contrast to e.g. bitmap heap scans, no alternative way to
perform tablesample queries. If an AM can't deal with the block based
API, it will have to throw an ERROR.

The tableam callbacks for this are block based, but given the current
TsmRoutine interface, that seems to be required.

The new interface doesn't require TsmRoutines to perform visibility
checks anymore - that requires the TsmRoutine to know details about
the AM, which we want to avoid.  To continue to allow taking the
returned number of tuples account SampleScanState now has a donetuples
field (which previously e.g. existed in SystemRowsSamplerData), which
is only incremented after the visibility check succeeds.

Author: Andres Freund
Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/73c954d24896aeb05de0f81d75e891a858e439e9

Modified Files
--------------
contrib/tsm_system_rows/tsm_system_rows.c |  86 ++---------
contrib/tsm_system_time/tsm_system_time.c |  13 +-
doc/src/sgml/tablesample-method.sgml      |   9 +-
src/backend/access/heap/heapam_handler.c  | 229 +++++++++++++++++++++++++++
src/backend/access/table/tableamapi.c     |   3 +
src/backend/access/tablesample/system.c   |  11 +-
src/backend/executor/nodeSamplescan.c     | 249 ++++--------------------------
src/include/access/tableam.h              |  88 +++++++++++
src/include/access/tsmapi.h               |   3 +-
src/include/nodes/execnodes.h             |   3 +
10 files changed, 382 insertions(+), 312 deletions(-)


pgsql-committers by date:

Previous
From: Peter Geoghegan
Date:
Subject: pgsql: Fix nbtree high key "continuescan" row compare bug.
Next
From: Noah Misch
Date:
Subject: pgsql: Update HINT for pre-existing shared memory block.