diff options
author | Thomas Munro <tmunro@postgresql.org> | 2021-03-17 13:43:08 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2021-03-17 15:04:17 +1300 |
commit | 9e7ccd9ef64d05e87ceb1985d459bef9031205c0 (patch) | |
tree | e9c08e635eaf51d79a0f498312870a26a3d4f150 /doc/src | |
parent | fbe4cb3bd49f9e524f53ef77c775c1bad4d0312a (diff) | |
download | postgresql-9e7ccd9ef64d05e87ceb1985d459bef9031205c0.tar.gz postgresql-9e7ccd9ef64d05e87ceb1985d459bef9031205c0.zip |
Enable parallelism in REFRESH MATERIALIZED VIEW.
Pass CURSOR_OPT_PARALLEL_OK to pg_plan_query() so that parallel plans
are considered when running the underlying SELECT query. This wasn't
done in commit e9baa5e9, which did this for CREATE MATERIALIZED VIEW,
because it wasn't yet known to be safe.
Since REFRESH always inserts into a freshly created table before later
merging or swapping the data into place with separate operations, we can
enable such plans here too.
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Hou, Zhijie <houzj.fnst@cn.fujitsu.com>
Reviewed-by: Luc Vlaming <luc@swarm64.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CALj2ACXg-4hNKJC6nFnepRHYT4t5jJVstYvri%2BtKQHy7ydcr8A%40mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/parallel.sgml | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml index cec1329e259..330c06b608f 100644 --- a/doc/src/sgml/parallel.sgml +++ b/doc/src/sgml/parallel.sgml @@ -144,11 +144,27 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; The query writes any data or locks any database rows. If a query contains a data-modifying operation either at the top level or within a CTE, no parallel plans for that query will be generated. As an - exception, the commands <literal>CREATE TABLE ... AS</literal>, <literal>SELECT - INTO</literal>, and <literal>CREATE MATERIALIZED VIEW</literal> which create a new - table and populate it can use a parallel plan. Another exception is the command - <literal>INSERT INTO ... SELECT ...</literal> which can use a parallel plan for - the underlying <literal>SELECT</literal> part of the query. + exception, the following commands which create a new table and populate + it can use a parallel plan for the underlying <literal>SELECT</literal> + part of the query: + + <itemizedlist> + <listitem> + <para><command>CREATE TABLE ... AS</command></para> + </listitem> + <listitem> + <para><command>SELECT INTO</command></para> + </listitem> + <listitem> + <para><command>INSERT INTO ... SELECT</command></para> + </listitem> + <listitem> + <para><command>CREATE MATERIALIZED VIEW</command></para> + </listitem> + <listitem> + <para><command>REFRESH MATERIALIZED VIEW</command></para> + </listitem> + </itemizedlist> </para> </listitem> |