5 -- encourage use of parallel plans
6 set parallel_setup_cost=0;
7 set parallel_tuple_cost=0;
8 set min_parallel_table_scan_size=0;
9 set max_parallel_workers_per_gather=4;
11 -- Test write operations that has an underlying query that is eligible
14 explain (costs off) create table parallel_write as
15 select length(stringu1) from tenk1 group by length(stringu1);
17 ---------------------------------------------------
18 Finalize HashAggregate
19 Group Key: (length((stringu1)::text))
22 -> Partial HashAggregate
23 Group Key: length((stringu1)::text)
24 -> Parallel Seq Scan on tenk1
27 create table parallel_write as
28 select length(stringu1) from tenk1 group by length(stringu1);
29 drop table parallel_write;
30 explain (costs off) select length(stringu1) into parallel_write
31 from tenk1 group by length(stringu1);
33 ---------------------------------------------------
34 Finalize HashAggregate
35 Group Key: (length((stringu1)::text))
38 -> Partial HashAggregate
39 Group Key: length((stringu1)::text)
40 -> Parallel Seq Scan on tenk1
43 select length(stringu1) into parallel_write
44 from tenk1 group by length(stringu1);
45 drop table parallel_write;
46 explain (costs off) create materialized view parallel_mat_view as
47 select length(stringu1) from tenk1 group by length(stringu1);
49 ---------------------------------------------------
50 Finalize HashAggregate
51 Group Key: (length((stringu1)::text))
54 -> Partial HashAggregate
55 Group Key: length((stringu1)::text)
56 -> Parallel Seq Scan on tenk1
59 create materialized view parallel_mat_view as
60 select length(stringu1) from tenk1 group by length(stringu1);
61 create unique index on parallel_mat_view(length);
62 refresh materialized view parallel_mat_view;
63 refresh materialized view concurrently parallel_mat_view;
64 drop materialized view parallel_mat_view;
65 prepare prep_stmt as select length(stringu1) from tenk1 group by length(stringu1);
66 explain (costs off) create table parallel_write as execute prep_stmt;
68 ---------------------------------------------------
69 Finalize HashAggregate
70 Group Key: (length((stringu1)::text))
73 -> Partial HashAggregate
74 Group Key: length((stringu1)::text)
75 -> Parallel Seq Scan on tenk1
78 create table parallel_write as execute prep_stmt;
79 drop table parallel_write;