pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode
Date: 2021-03-18 02:14:27
Message-ID: E1lMiB9-0001c3-SY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a new GUC and a reloption to enable inserts in parallel-mode.

Commit 05c8482f7f added the implementation of parallel SELECT for
"INSERT INTO ... SELECT ..." which may incur non-negligible overhead in
the additional parallel-safety checks that it performs, even when, in the
end, those checks determine that parallelism can't be used. This is
normally only ever a problem in the case of when the target table has a
large number of partitions.

A new GUC option "enable_parallel_insert" is added, to allow insert in
parallel-mode. The default is on.

In addition to the GUC option, the user may want a mechanism to allow
inserts in parallel-mode with finer granularity at table level. The new
table option "parallel_insert_enabled" allows this. The default is true.

Author: "Hou, Zhijie"
Reviewed-by: Greg Nancarrow, Amit Langote, Takayuki Tsunakawa, Amit Kapila
Discussion: https://postgr.es/m/CAA4eK1K-cW7svLC2D7DHoGHxdAdg3P37BLgebqBOC2ZLc9a6QQ%40mail.gmail.com
Discussion: https://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV=qpFJrR3AcrTS3g@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c8f78b616167bf8e24bc5dc69112c37755ed3058

Modified Files
--------------
doc/src/sgml/config.sgml | 23 +++++++++++
doc/src/sgml/ref/alter_table.sgml | 3 +-
doc/src/sgml/ref/create_table.sgml | 26 +++++++++++++
src/backend/access/common/reloptions.c | 25 +++++++++---
src/backend/optimizer/path/costsize.c | 2 +
src/backend/optimizer/util/clauses.c | 34 ++++++++++++++--
src/backend/utils/misc/guc.c | 10 +++++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/bin/psql/tab-complete.c | 1 +
src/include/optimizer/cost.h | 1 +
src/include/utils/rel.h | 25 ++++++++++++
src/test/regress/expected/insert_parallel.out | 56 ++++++++++++++++++++++++++-
src/test/regress/expected/sysviews.out | 3 +-
src/test/regress/sql/insert_parallel.sql | 44 ++++++++++++++++++++-
src/tools/pgindent/typedefs.list | 1 +
15 files changed, 240 insertions(+), 15 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2021-03-18 10:07:04 pgsql: Doc: Update description for parallel insert reloption.
Previous Message Andres Freund 2021-03-17 23:24:57 pgsql: Fix memory lifetime issues of replication slot stats.