postgresql/src/tools
Tomas Vondra b437571714 Allow parallel CREATE INDEX for BRIN indexes
Allow using multiple worker processes to build BRIN index, which until
now was supported only for BTREE indexes. For large tables this often
results in significant speedup when the build is CPU-bound.

The work is split in a simple way - each worker builds BRIN summaries on
a subset of the table, determined by the regular parallel scan used to
read the data, and feeds them into a shared tuplesort which sorts them
by blkno (start of the range). The leader then reads this sorted stream
of ranges, merges duplicates (which may happen if the parallel scan does
not align with BRIN pages_per_range), and adds the resulting ranges into
the index.

The number of duplicate results produced by workers (requiring merging
in the leader process) should be fairly small, thanks to how parallel
scans assign chunks to workers. The likelihood of duplicate results may
increase for higher pages_per_range values, but then there are fewer
page ranges in total. In any case, we expect the merging to be much
cheaper than summarization, so this should be a win.

Most of the parallelism infrastructure is a simplified copy of the code
used by BTREE indexes, omitting the parts irrelevant for BRIN indexes
(e.g. uniqueness checks).

This also introduces a new index AM flag amcanbuildparallel, determining
whether to attempt to start parallel workers for the index build.

Original patch by me, with reviews and substantial reworks by Matthias
van de Meent, certainly enough to make him a co-author.

Author: Tomas Vondra, Matthias van de Meent
Reviewed-by: Matthias van de Meent
Discussion: https://postgr.es/m/c2ee7d69-ce17-43f2-d1a0-9811edbda6e6%40enterprisedb.com
2023-12-08 18:15:26 +01:00
..
ci ci: Make compute resources for CI configurable 2023-08-23 15:15:28 -07:00
editors Make Emacs perl-mode indent more like perltidy. 2019-01-13 11:32:31 -08:00
ifaddrs Remove distprep 2023-11-06 15:18:04 +01:00
msvc Read include/exclude commands for dump/restore from file 2023-11-29 14:56:24 +01:00
perlcheck Allow and require passing files on command line of pgperltidy 2023-06-21 16:20:26 +02:00
pg_bsd_indent Ensure we use the correct spelling of "ensure" 2023-11-10 00:15:54 +13:00
pginclude Doc: update src/tools/pginclude/README. 2023-05-23 18:51:43 -04:00
pgindent Allow parallel CREATE INDEX for BRIN indexes 2023-12-08 18:15:26 +01:00
PerfectHash.pm Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
RELEASE_CHANGES Add defenses against unexpected changes in the NodeTag enum list. 2022-07-12 11:22:52 -04:00
ccsym tools/ccsym: update for modern versions of gcc 2015-01-20 13:02:58 -05:00
check_bison_recursion.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
codelines Fix remaining stray references to CVS. 2010-09-22 19:51:39 -04:00
copyright.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
darwin_sysroot Move darwin sysroot determination into separate file 2022-09-01 16:54:19 -07:00
find_badmacros Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
find_meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
find_static Fix `trap` in a few shell scripts 2022-09-20 18:50:16 +02:00
find_typedef Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
fix-old-flex-code.pl Update copyright for 2023 2023-01-02 15:00:37 -05:00
gen_export.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
gen_keywordlist.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
git-external-diff Preserve information on use of git-external-diff 2018-05-24 23:45:31 +09:30
git_changelog Stamp HEAD as 17devel. 2023-06-29 19:05:23 -04:00
install_files meson: make install_test_files more generic, rename to install_files 2023-03-23 21:20:18 -07:00
make_ctags Fix make_etags breakage on certain platforms. 2023-06-14 11:02:50 +09:00
make_etags Fix make_etags failure on Mac. 2023-02-15 09:52:42 +09:00
make_mkid Add another pgdefine path check, and a cvs-git change. 2011-08-26 21:52:35 -04:00
mark_pgdllimport.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
pgflex meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pgtest pgtest: fix spacing 2023-08-14 14:03:29 -04:00
rcgen meson: Add windows resource files 2022-10-05 09:56:05 -07:00
testint128.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
testwrap Explicitly skip TAP tests under Meson if disabled 2023-11-16 08:14:33 +01:00
valgrind.supp Record dependencies of a cast on other casts that it requires. 2022-10-17 14:02:05 -04:00
version_stamp.pl Stamp HEAD as 17devel. 2023-06-29 19:05:23 -04:00
win32tzlist.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00