blob: 55c03f7eb3eb1eaba27961bf4bcc700e68e1e9f7 [file] [log] [blame]
--
-- 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);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
QUERY PLAN
------------------------------------------------------
HashAggregate
Group Key: (length((stringu1)::text))
-> Redistribute Motion 3:3 (slice1; segments: 3)
Hash Key: (length((stringu1)::text))
-> HashAggregate
Group Key: length((stringu1)::text)
-> Seq Scan on tenk1
Optimizer: Postgres query optimizer
(8 rows)
create table parallel_write as
select length(stringu1) from tenk1 group by length(stringu1);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
drop table parallel_write;
explain (costs off) select length(stringu1) into parallel_write
from tenk1 group by length(stringu1);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
QUERY PLAN
------------------------------------------------------
HashAggregate
Group Key: (length((stringu1)::text))
-> Redistribute Motion 3:3 (slice1; segments: 3)
Hash Key: (length((stringu1)::text))
-> HashAggregate
Group Key: length((stringu1)::text)
-> Seq Scan on tenk1
Optimizer: Postgres query optimizer
(8 rows)
select length(stringu1) into parallel_write
from tenk1 group by length(stringu1);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
drop table parallel_write;
explain (costs off) create materialized view parallel_mat_view as
select length(stringu1) from tenk1 group by length(stringu1);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
QUERY PLAN
------------------------------------------------------
HashAggregate
Group Key: (length((stringu1)::text))
-> Redistribute Motion 3:3 (slice1; segments: 3)
Hash Key: (length((stringu1)::text))
-> HashAggregate
Group Key: length((stringu1)::text)
-> Seq Scan on tenk1
Optimizer: Postgres query optimizer
(8 rows)
create materialized view parallel_mat_view as
select length(stringu1) from tenk1 group by length(stringu1);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
create unique index on parallel_mat_view(length);
refresh materialized view parallel_mat_view;
refresh materialized view concurrently parallel_mat_view;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'tid' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
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;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
QUERY PLAN
------------------------------------------------------
HashAggregate
Group Key: (length((stringu1)::text))
-> Redistribute Motion 3:3 (slice1; segments: 3)
Hash Key: (length((stringu1)::text))
-> HashAggregate
Group Key: length((stringu1)::text)
-> Seq Scan on tenk1
Optimizer: Postgres query optimizer
(8 rows)
create table parallel_write as execute prep_stmt;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column(s) named 'length' as the Apache Cloudberry data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
drop table parallel_write;
rollback;