pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't require return slots for nodes without projection.
Date: Sat, 10 Nov 2018 01:27:17 +0000
Message-ID: <E1gLI3R-0008Pd-Gy@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1gLI3R-0008Pd-Gy@gemulon.postgresql.org>
Permalink:  ../E1gLI3R-0008Pd-Gy@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gLI3R-0008Pd-Gy@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Don't require return slots for nodes without projection.
  In-Reply-To: <E1gLI3R-0008Pd-Gy@gemulon.postgresql.org>
  References: <E1gLI3R-0008Pd-Gy@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox