postgresql/src/include
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
..
access Fix incorrect routine name in xlog_heapam.h 2018-11-10 08:58:55 +09:00
bootstrap Rationalize handling of array type names in bootstrap data. 2018-04-17 18:29:11 -04:00
catalog Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03:00
commands Lower lock level for renaming indexes 2018-11-14 17:09:54 +01:00
common Add application_name to connection authorized msg 2018-09-28 19:04:50 -04:00
datatype Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03:00
fe_utils Reorganize format options of psql in alphabetical order 2018-11-06 15:04:40 +09:00
foreign Allow insert and update tuple routing and COPY for foreign tables. 2018-04-06 19:22:03 -04:00
jit Don't generate tuple deforming functions for virtual slots. 2018-11-15 22:00:30 -08:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
mb Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
nodes Redesign initialization of partition routing structures 2018-11-16 15:01:05 -03:00
optimizer Remove some unnecessary fields from Plan trees. 2018-10-07 14:33:17 -04:00
parser Sprinkle some const decorations 2018-10-23 12:25:17 +02:00
partitioning Refactor code creating PartitionBoundInfo 2018-11-14 10:01:49 +09:00
port Convert elog.c's useful_strerror() into a globally-used strerror wrapper. 2018-09-26 11:06:42 -04:00
portability Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Fix spelling errors and typos in comments 2018-11-02 13:56:52 +01:00
rewrite Revert MERGE patch 2018-04-12 11:22:56 +01:00
snowball Sync our Snowball stemmer dictionaries with current upstream. 2018-09-24 17:29:38 -04:00
statistics Update copyright for 2018 2018-01-02 23:30:12 -05:00
storage Use 64 bit type for BufFileSize(). 2018-11-15 13:13:57 +13:00
tcop Fix event triggers for partitioned tables 2018-10-06 19:17:46 -03:00
tsearch Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
utils A small tweak to some comments for PartitionKeyData 2018-11-15 23:22:19 +01:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Improve unconstify() documentation 2018-10-25 01:02:46 +01:00
fmgr.h Add expression compilation support to LLVM JIT provider. 2018-03-22 14:45:59 -07:00
funcapi.h Clean up in the wake of TupleDescGetSlot() removal / 10763358c3. 2018-09-27 11:38:11 -07:00
getaddrinfo.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
getopt_long.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
miscadmin.h Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
pg_config.h.in Fix inadequate autoconfiscation of copyfile() usage. 2018-11-07 16:41:42 -05:00
pg_config.h.win32 Provide pg_pread() and pg_pwrite() for random I/O. 2018-11-07 09:50:01 +13:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Improve error reporting for unsupported effective_io_concurrency setting. 2018-09-28 16:12:13 -04:00
pg_getopt.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_trace.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgstat.h Add pg_promote function 2018-10-25 09:46:00 +09:00
pgtar.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgtime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
port.h Provide pg_pread() and pg_pwrite() for random I/O. 2018-11-07 09:50:01 +13:00
postgres.h Detoast plpgsql variables if they might live across a transaction boundary. 2018-05-16 14:56:52 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rusagestub.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
windowapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00