postgresql/src/include/executor
Alvaro Herrera 3f2393edef Redesign initialization of partition routing structures
This speeds up write operations (INSERT, UPDATE, DELETE, COPY, as well
as the future MERGE) on partitioned tables.

This changes the setup for tuple routing so that it does far less work
during the initial setup and pushes more work out to when partitions
receive tuples.  PartitionDispatchData structs for sub-partitioned
tables are only created when a tuple gets routed through it.  The
possibly large arrays in the PartitionTupleRouting struct have largely
been removed.  The partitions[] array remains but now never contains any
NULL gaps.  Previously the NULLs had to be skipped during
ExecCleanupTupleRouting(), which could add a large overhead to the
cleanup when the number of partitions was large.  The partitions[] array
is allocated small to start with and only enlarged when we route tuples
to enough partitions that it runs out of space. This allows us to keep
simple single-row partition INSERTs running quickly.  Redesign

The arrays in PartitionTupleRouting which stored the tuple translation maps
have now been removed.  These have been moved out into a
PartitionRoutingInfo struct which is an additional field in ResultRelInfo.

The find_all_inheritors() call still remains by far the slowest part of
ExecSetupPartitionTupleRouting(). This commit just removes the other slow
parts.

In passing also rename the tuple translation maps from being ParentToChild
and ChildToParent to being RootToPartition and PartitionToRoot. The old
names mislead you into thinking that a partition of some sub-partitioned
table would translate to the rowtype of the sub-partitioned table rather
than the root partitioned table.

Authors: David Rowley and Amit Langote, heavily revised by Álvaro Herrera
Testing help from Jesper Pedersen and Kato Sho.
Discussion: https://postgr.es/m/CAKJS1f_1RJyFquuCKRFHTdcXqoPX-PYqAd7nz=GVBwvGh4a6xA@mail.gmail.com
2018-11-16 15:01:05 -03:00
..
execExpr.h Compute information about EEOP_*_FETCHSOME at expression init time. 2018-11-15 22:00:30 -08:00
execParallel.h Collect JIT instrumentation from workers. 2018-09-25 13:12:44 -07:00
execPartition.h Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03: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 Introduce notion of different types of slots (without implementing them). 2018-11-15 22:00:30 -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 Add dummy field to currently empty struct TupleTableSlotOps. 2018-11-15 22:29:50 -08:00