Enable parallelism in REFRESH MATERIALIZED VIEW.
authorThomas Munro <tmunro@postgresql.org>
Wed, 17 Mar 2021 00:43:08 +0000 (13:43 +1300)
committerThomas Munro <tmunro@postgresql.org>
Wed, 17 Mar 2021 02:04:17 +0000 (15:04 +1300)
commit9e7ccd9ef64d05e87ceb1985d459bef9031205c0
treee9c08e635eaf51d79a0f498312870a26a3d4f150
parentfbe4cb3bd49f9e524f53ef77c775c1bad4d0312a
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
doc/src/sgml/parallel.sgml
src/backend/commands/matview.c
src/test/regress/expected/write_parallel.out
src/test/regress/sql/write_parallel.sql