postgresql/src/include/nodes
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
..
bitmapset.h Add bms_prev_member function 2018-04-07 17:54:39 -03:00
execnodes.h Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03:00
extensible.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
lockoptions.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
makefuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
memnodes.h Allow memory contexts to have both fixed and variable ident strings. 2018-03-27 16:46:51 -04:00
nodeFuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes.h Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
params.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
parsenodes.h Revise attribute handling code on partition creation 2018-11-08 16:22:09 -03:00
pg_list.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
plannodes.h Correct code comments for PartitionedRelPruneInfo struct 2018-11-15 23:04:48 +01:00
primnodes.h Fix interaction of CASE and ArrayCoerceExpr. 2018-10-30 15:26:11 -04:00
print.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
readfuncs.h Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
relation.h Postpone calculating total_table_pages until after pruning/exclusion. 2018-11-07 12:12:56 -05:00
replnodes.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tidbitmap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
value.h Change internal integer representation of Value node 2018-03-13 09:56:25 -04:00