postgresql/src/include/executor
Andres Freund 1ef6bd2954 Don't require return slots for nodes without projection.
In a lot of nodes the return slot is not required. That can either be
because the node doesn't do any projection (say an Append node), or
because the node does perform projections but the projection is
optimized away because the projection would yield an identical row.

Slots aren't that small, especially for wide rows, so it's worthwhile
to avoid creating them.  It's not possible to just skip creating the
slot - it's currently used to determine the tuple descriptor returned
by ExecGetResultType().  So separate the determination of the result
type from the slot creation.  The work previously done internally
ExecInitResultTupleSlotTL() can now also be done separately with
ExecInitResultTypeTL() and ExecInitResultSlot().  That way nodes that
aren't guaranteed to need a result slot, can use
ExecInitResultTypeTL() to determine the result type of the node, and
ExecAssignScanProjectionInfo() (via
ExecConditionalAssignProjectionInfo()) determines that a result slot
is needed, it is created with ExecInitResultSlot().

Besides the advantage of avoiding to create slots that then are
unused, this is necessary preparation for later patches around tuple
table slot abstraction. In particular separating the return descriptor
and slot is a prerequisite to allow JITing of tuple deforming with
knowledge of the underlying tuple format, and to avoid unnecessarily
creating JITed tuple deforming for virtual slots.

This commit removes a redundant argument from
ExecInitResultTupleSlotTL(). While this commit touches a lot of the
relevant lines anyway, it'd normally still not worthwhile to cause
breakage, except that aforementioned later commits will touch *all*
ExecInitResultTupleSlotTL() callers anyway (but fits worse
thematically).

Author: Andres Freund
Discussion: https://postgr.es/m/20181105210039.hh4vvi4vwoq5ba2q@alap3.anarazel.de
2018-11-09 17:19:39 -08:00
..
execExpr.h Move EEOP_*_SYSVAR evaluation out of line. 2018-11-07 11:08:45 -08:00
execParallel.h Collect JIT instrumentation from workers. 2018-09-25 13:12:44 -07:00
execPartition.h Centralize executor's opening/closing of Relations for rangetable entries. 2018-10-04 14:03:42 -04:00
execdebug.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
execdesc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor.h Don't require return slots for nodes without projection. 2018-11-09 17:19:39 -08:00
functions.h Support INOUT arguments in procedures 2018-03-14 12:07:28 -04:00
hashjoin.h Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
instrument.h Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
nodeAgg.h Improve spelling of new FINALFUNC_MODIFY aggregate attribute. 2018-05-21 11:41:42 -04:00
nodeAppend.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapAnd.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapHeapscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapIndexscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeBitmapOr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeCtescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeCustom.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeForeignscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeFunctionscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeGather.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeGatherMerge.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeGroup.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeHash.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeHashjoin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeIndexonlyscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeIndexscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeLimit.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeLockRows.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeMaterial.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeMergeAppend.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeMergejoin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeModifyTable.h Revert MERGE patch 2018-04-12 11:22:56 +01:00
nodeNamedtuplestorescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeNestloop.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeProjectSet.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeRecursiveunion.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeResult.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSamplescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSeqscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSetOp.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSort.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeSubplan.h Fix failure with initplans used conditionally during EvalPlanQual rechecks. 2018-09-15 13:42:33 -04:00
nodeSubqueryscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeTableFuncscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeTidscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeUnique.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeValuesscan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeWindowAgg.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodeWorktablescan.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spi.h Advance transaction timestamp for intra-procedure transactions. 2018-10-08 16:16:36 -04:00
spi_priv.h Save/restore SPI's global variables in SPI_connect() and SPI_finish(). 2018-09-07 20:09:57 -04:00
tablefunc.h Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
tqueue.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tstoreReceiver.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tuptable.h Move TupleTableSlots boolean member into one flag variable. 2018-10-15 18:23:25 -07:00