pgsql: Don't require return slots for nodes without projection.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Don't require return slots for nodes without projection.
Дата
Msg-id E1gLI3R-0008Pd-Gy@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

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

Modified Files
--------------
src/backend/executor/execTuples.c              | 73 +++++++++++++++++++-------
src/backend/executor/execUtils.c               |  8 +--
src/backend/executor/nodeAgg.c                 |  2 +-
src/backend/executor/nodeAppend.c              |  2 +-
src/backend/executor/nodeBitmapHeapscan.c      |  7 +--
src/backend/executor/nodeCtescan.c             | 10 ++--
src/backend/executor/nodeCustom.c              |  2 +-
src/backend/executor/nodeForeignscan.c         |  5 +-
src/backend/executor/nodeFunctionscan.c        |  8 +--
src/backend/executor/nodeGather.c              |  7 +--
src/backend/executor/nodeGatherMerge.c         |  7 +--
src/backend/executor/nodeGroup.c               |  2 +-
src/backend/executor/nodeHash.c                |  2 +-
src/backend/executor/nodeHashjoin.c            |  2 +-
src/backend/executor/nodeIndexonlyscan.c       | 10 ++--
src/backend/executor/nodeIndexscan.c           |  7 +--
src/backend/executor/nodeLimit.c               |  5 +-
src/backend/executor/nodeLockRows.c            |  5 +-
src/backend/executor/nodeMaterial.c            |  2 +-
src/backend/executor/nodeMergeAppend.c         |  4 +-
src/backend/executor/nodeMergejoin.c           |  2 +-
src/backend/executor/nodeModifyTable.c         |  7 +--
src/backend/executor/nodeNamedtuplestorescan.c | 21 ++++----
src/backend/executor/nodeNestloop.c            |  2 +-
src/backend/executor/nodeProjectSet.c          |  2 +-
src/backend/executor/nodeRecursiveunion.c      |  7 +--
src/backend/executor/nodeResult.c              |  2 +-
src/backend/executor/nodeSamplescan.c          |  8 +--
src/backend/executor/nodeSeqscan.c             |  7 +--
src/backend/executor/nodeSetOp.c               |  2 +-
src/backend/executor/nodeSort.c                |  2 +-
src/backend/executor/nodeSubqueryscan.c        |  9 ++--
src/backend/executor/nodeTableFuncscan.c       | 10 ++--
src/backend/executor/nodeTidscan.c             |  7 +--
src/backend/executor/nodeUnique.c              |  2 +-
src/backend/executor/nodeValuesscan.c          | 10 ++--
src/backend/executor/nodeWindowAgg.c           |  2 +-
src/backend/executor/nodeWorktablescan.c       |  8 +--
src/include/executor/executor.h                |  4 +-
src/include/nodes/execnodes.h                  |  1 +
40 files changed, 168 insertions(+), 117 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix incorrect routine name in xlog_heapam.h
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Remove ineffective check against dropped columns fromslot_getat