pgsql: Introduce notion of different types of slots (without implementi

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Introduce notion of different types of slots (without implementi
Date: 2018-11-16 06:01:11
Message-ID: E1gNXBn-0002LS-2S@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Introduce notion of different types of slots (without implementing them).

Upcoming work intends to allow pluggable ways to introduce new ways of
storing table data. Accessing those table access methods from the
executor requires TupleTableSlots to be carry tuples in the native
format of such storage methods; otherwise there'll be a significant
conversion overhead.

Different access methods will require different data to store tuples
efficiently (just like virtual, minimal, heap already require fields
in TupleTableSlot). To allow that without requiring additional pointer
indirections, we want to have different structs (embedding
TupleTableSlot) for different types of slots. Thus different types of
slots are needed, which requires adapting creators of slots.

The slot that most efficiently can represent a type of tuple in an
executor node will often depend on the type of slot a child node
uses. Therefore we need to track the type of slot is returned by
nodes, so parent slots can create slots based on that.

Relatedly, JIT compilation of tuple deforming needs to know which type
of slot a certain expression refers to, so it can create an
appropriate deforming function for the type of tuple in the slot.

But not all nodes will only return one type of slot, e.g. an append
node will potentially return different types of slots for each of its
subplans.

Therefore add function that allows to query the type of a node's
result slot, and whether it'll always be the same type (whether it's
fixed). This can be queried using ExecGetResultSlotOps().

The scan, result, inner, outer type of slots are automatically
inferred from ExecInitScanTupleSlot(), ExecInitResultSlot(),
left/right subtrees respectively. If that's not correct for a node,
that can be overwritten using new fields in PlanState.

This commit does not introduce the actually abstracted implementation
of different kind of TupleTableSlots, that will be left for a followup
commit. The different types of slots introduced will, for now, still
use the same backing implementation.

While this already partially invalidates the big comment in
tuptable.h, it seems to make more sense to update it later, when the
different TupleTableSlot implementations actually exist.

Author: Ashutosh Bapat and Andres Freund, with changes by Amit Khandekar
Discussion: https://postgr.es/m/20181105210039.hh4vvi4vwoq5ba2q@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1a0586de3657cd35581f0639c87d5050c6197bb7

Modified Files
--------------
src/backend/access/heap/heapam.c | 3 +-
src/backend/catalog/index.c | 9 ++--
src/backend/catalog/indexing.c | 3 +-
src/backend/commands/analyze.c | 3 +-
src/backend/commands/constraint.c | 3 +-
src/backend/commands/copy.c | 6 ++-
src/backend/commands/explain.c | 3 +-
src/backend/commands/functioncmds.c | 3 +-
src/backend/commands/subscriptioncmds.c | 2 +-
src/backend/commands/tablecmds.c | 6 +--
src/backend/commands/trigger.c | 10 ++--
src/backend/executor/execExpr.c | 4 +-
src/backend/executor/execGrouping.c | 8 ++-
src/backend/executor/execIndexing.c | 3 +-
src/backend/executor/execJunk.c | 4 +-
src/backend/executor/execMain.c | 12 +++--
src/backend/executor/execPartition.c | 8 +--
src/backend/executor/execSRF.c | 3 +-
src/backend/executor/execTuples.c | 67 ++++++++++++++++++--------
src/backend/executor/execUtils.c | 47 ++++++++++++++++--
src/backend/executor/functions.c | 24 +++++++--
src/backend/executor/nodeAgg.c | 17 ++++---
src/backend/executor/nodeAppend.c | 6 ++-
src/backend/executor/nodeBitmapHeapscan.c | 3 +-
src/backend/executor/nodeCtescan.c | 3 +-
src/backend/executor/nodeCustom.c | 7 +--
src/backend/executor/nodeForeignscan.c | 10 +++-
src/backend/executor/nodeFunctionscan.c | 6 ++-
src/backend/executor/nodeGather.c | 8 ++-
src/backend/executor/nodeGatherMerge.c | 10 +++-
src/backend/executor/nodeGroup.c | 6 ++-
src/backend/executor/nodeHash.c | 2 +-
src/backend/executor/nodeHashjoin.c | 15 +++---
src/backend/executor/nodeIndexonlyscan.c | 2 +-
src/backend/executor/nodeIndexscan.c | 21 +++++---
src/backend/executor/nodeLimit.c | 4 ++
src/backend/executor/nodeLockRows.c | 5 ++
src/backend/executor/nodeMaterial.c | 10 ++--
src/backend/executor/nodeMergeAppend.c | 6 ++-
src/backend/executor/nodeMergejoin.c | 15 +++---
src/backend/executor/nodeModifyTable.c | 28 ++++++++---
src/backend/executor/nodeNamedtuplestorescan.c | 3 +-
src/backend/executor/nodeNestloop.c | 5 +-
src/backend/executor/nodeProjectSet.c | 2 +-
src/backend/executor/nodeResult.c | 2 +-
src/backend/executor/nodeSamplescan.c | 3 +-
src/backend/executor/nodeSeqscan.c | 3 +-
src/backend/executor/nodeSetOp.c | 4 +-
src/backend/executor/nodeSort.c | 4 +-
src/backend/executor/nodeSubplan.c | 5 +-
src/backend/executor/nodeSubqueryscan.c | 13 ++++-
src/backend/executor/nodeTableFuncscan.c | 3 +-
src/backend/executor/nodeTidscan.c | 3 +-
src/backend/executor/nodeUnique.c | 2 +-
src/backend/executor/nodeValuesscan.c | 2 +-
src/backend/executor/nodeWindowAgg.c | 27 ++++++++---
src/backend/executor/nodeWorktablescan.c | 7 ++-
src/backend/partitioning/partbounds.c | 2 +-
src/backend/replication/logical/tablesync.c | 4 +-
src/backend/replication/logical/worker.c | 20 +++++---
src/backend/replication/walsender.c | 6 +--
src/backend/tcop/pquery.c | 2 +-
src/backend/utils/adt/orderedsetaggs.c | 6 ++-
src/backend/utils/adt/selfuncs.c | 3 +-
src/backend/utils/misc/guc.c | 4 +-
src/backend/utils/sort/tuplesort.c | 2 +-
src/include/executor/executor.h | 28 ++++++++---
src/include/executor/tuptable.h | 35 +++++++++++---
src/include/nodes/execnodes.h | 39 +++++++++++++++
69 files changed, 478 insertions(+), 176 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2018-11-16 06:31:32 pgsql: Add dummy field to currently empty struct TupleTableSlotOps.
Previous Message Michael Paquier 2018-11-15 22:43:04 Re: pgsql: Add flag values in WAL description to all heap records