pgsql: tableam: sample scan.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: tableam: sample scan.
Date: 2019-04-01 01:42:13
Message-ID: E1hAlxl-0001xr-DK@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2019-04-01 02:34:13 pgsql: Update HINT for pre-existing shared memory block.
Previous Message Peter Geoghegan 2019-04-01 00:27:29 pgsql: Fix nbtree high key "continuescan" row compare bug.