]> granicus.if.org Git - postgresql/commit
tableam: sample scan.
authorAndres Freund <andres@anarazel.de>
Sun, 31 Mar 2019 03:18:53 +0000 (20:18 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 1 Apr 2019 01:37:57 +0000 (18:37 -0700)
commit73c954d24896aeb05de0f81d75e891a858e439e9
treefd4ef1ff3c9b695b061ea3180ecda8fbea8c8b9b
parent4bb50236eb561f4639e75a393a5a1c9b8681acfb
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
contrib/tsm_system_rows/tsm_system_rows.c
contrib/tsm_system_time/tsm_system_time.c
doc/src/sgml/tablesample-method.sgml
src/backend/access/heap/heapam_handler.c
src/backend/access/table/tableamapi.c
src/backend/access/tablesample/system.c
src/backend/executor/nodeSamplescan.c
src/include/access/tableam.h
src/include/access/tsmapi.h
src/include/nodes/execnodes.h