postgresql/src
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
..
backend Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03:00
bin Make psql's "\pset format" command reject non-unique abbreviations. 2018-11-14 16:39:59 -05:00
common Make spelling of "acknowledgment" consistent 2018-10-15 10:06:45 +02:00
fe_utils Fix realfailN lexer rules to not make assumptions about input format. 2018-11-13 14:54:41 -05:00
include Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03:00
interfaces Second try at fixing numeric data passed through an ECPG SQLDA. 2018-11-14 11:27:47 -05:00
makefiles Refactor installation of extension headers. 2018-09-07 14:19:14 +01:00
pl Fix error-cleanup mistakes in exec_stmt_call(). 2018-11-09 22:04:14 -05:00
port Disable MSVC warning caused by recent snprintf.c changes 2018-11-10 20:20:54 -05:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Improve performance of partition pruning remapping a little. 2018-11-15 13:34:16 -05:00
timezone Sync our copy of the timezone library with IANA release tzcode2018g. 2018-10-31 09:47:53 -04:00
tools Adjust valgrind fix in commit 517b0d0b5f 2018-11-08 08:38:46 -05:00
tutorial Deduplicate "invalid input syntax" messages for various types. 2018-07-22 14:58:01 -07:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Remove useless symbol from Makefile.global. 2018-11-06 10:57:51 -05:00
Makefile.shlib Don't build static libraries on Cygwin 2018-10-02 16:46:57 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00