summaryrefslogtreecommitdiffstats
path: root/src/test/regress/expected/write_parallel.out
blob: dc0c4ba587e16b46b727e5912aa07092cbc0adc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--
-- PARALLEL
--
begin;
-- encourage use of parallel plans
set parallel_setup_cost=0;
set parallel_tuple_cost=0;
set min_parallel_table_scan_size=0;
set max_parallel_workers_per_gather=4;
--
-- Test write operations that has an underlying query that is eligible
-- for parallel plans
--
explain (costs off) create table parallel_write as
    select length(stringu1) from tenk1 group by length(stringu1);
                    QUERY PLAN                     
---------------------------------------------------
 Finalize HashAggregate
   Group Key: (length((stringu1)::text))
   ->  Gather
         Workers Planned: 4
         ->  Partial HashAggregate
               Group Key: length((stringu1)::text)
               ->  Parallel Seq Scan on tenk1
(7 rows)

create table parallel_write as
    select length(stringu1) from tenk1 group by length(stringu1);
drop table parallel_write;
explain (costs off) select length(stringu1) into parallel_write
    from tenk1 group by length(stringu1);
                    QUERY PLAN                     
---------------------------------------------------
 Finalize HashAggregate
   Group Key: (length((stringu1)::text))
   ->  Gather
         Workers Planned: 4
         ->  Partial HashAggregate
               Group Key: length((stringu1)::text)
               ->  Parallel Seq Scan on tenk1
(7 rows)

select length(stringu1) into parallel_write
    from tenk1 group by length(stringu1);
drop table parallel_write;
explain (costs off) create materialized view parallel_mat_view as
    select length(stringu1) from tenk1 group by length(stringu1);
                    QUERY PLAN                     
---------------------------------------------------
 Finalize HashAggregate
   Group Key: (length((stringu1)::text))
   ->  Gather
         Workers Planned: 4
         ->  Partial HashAggregate
               Group Key: length((stringu1)::text)
               ->  Parallel Seq Scan on tenk1
(7 rows)

create materialized view parallel_mat_view as
    select length(stringu1) from tenk1 group by length(stringu1);
create unique index on parallel_mat_view(length);
refresh materialized view parallel_mat_view;
refresh materialized view concurrently parallel_mat_view;
drop materialized view parallel_mat_view;
prepare prep_stmt as select length(stringu1) from tenk1 group by length(stringu1);
explain (costs off) create table parallel_write as execute prep_stmt;
                    QUERY PLAN                     
---------------------------------------------------
 Finalize HashAggregate
   Group Key: (length((stringu1)::text))
   ->  Gather
         Workers Planned: 4
         ->  Partial HashAggregate
               Group Key: length((stringu1)::text)
               ->  Parallel Seq Scan on tenk1
(7 rows)

create table parallel_write as execute prep_stmt;
drop table parallel_write;
rollback;