mirror of https://github.com/citusdata/citus.git
Remove references to optimization PG15 reverted
PG15 introduced an optimization on GROUP BY keys that is now reverted on RC2. Relevant PG commit: Revert "Optimize order of GROUP BY keys". 443df6e2db932a7cd6d85ddfb67e11a43345130dpull/6418/head
parent
30af70926f
commit
cbe4298c5b
|
@ -463,29 +463,6 @@ DEBUG: Creating router plan
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
\set VERBOSITY default
|
\set VERBOSITY default
|
||||||
-- enable_group_by_reordering is a new GUC introduced in PG15
|
|
||||||
-- it does some optimization of the order of group by keys which results
|
|
||||||
-- in a different explain output plan between PG13/14 and PG15
|
|
||||||
-- Hence we set that GUC to off.
|
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15
|
|
||||||
\gset
|
|
||||||
\if :server_version_ge_15
|
|
||||||
SET enable_group_by_reordering TO off;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM SET enable_group_by_reordering TO off;$$);
|
|
||||||
?column?
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
run_command_on_workers
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
(localhost,57637,t,t)
|
|
||||||
(localhost,57638,t,t)
|
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
EXPLAIN (COSTS OFF) WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -524,22 +501,6 @@ DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
||||||
-> Seq Scan on test_table_1960000 test_table_1
|
-> Seq Scan on test_table_1960000 test_table_1
|
||||||
(12 rows)
|
(12 rows)
|
||||||
|
|
||||||
\if :server_version_ge_15
|
|
||||||
RESET enable_group_by_reordering;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM RESET enable_group_by_reordering;$$);
|
|
||||||
?column?
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
run_command_on_workers
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
(localhost,57637,t,t)
|
|
||||||
(localhost,57638,t,t)
|
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
-- ctes with volatile functions are not
|
-- ctes with volatile functions are not
|
||||||
-- inlined
|
-- inlined
|
||||||
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
||||||
|
|
|
@ -463,29 +463,6 @@ DEBUG: Creating router plan
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
\set VERBOSITY default
|
\set VERBOSITY default
|
||||||
-- enable_group_by_reordering is a new GUC introduced in PG15
|
|
||||||
-- it does some optimization of the order of group by keys which results
|
|
||||||
-- in a different explain output plan between PG13/14 and PG15
|
|
||||||
-- Hence we set that GUC to off.
|
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15
|
|
||||||
\gset
|
|
||||||
\if :server_version_ge_15
|
|
||||||
SET enable_group_by_reordering TO off;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM SET enable_group_by_reordering TO off;$$);
|
|
||||||
?column?
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
run_command_on_workers
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
(localhost,57637,t,t)
|
|
||||||
(localhost,57638,t,t)
|
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
EXPLAIN (COSTS OFF) WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -524,22 +501,6 @@ DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
||||||
-> Seq Scan on test_table_1960000 test_table_1
|
-> Seq Scan on test_table_1960000 test_table_1
|
||||||
(12 rows)
|
(12 rows)
|
||||||
|
|
||||||
\if :server_version_ge_15
|
|
||||||
RESET enable_group_by_reordering;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM RESET enable_group_by_reordering;$$);
|
|
||||||
?column?
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
run_command_on_workers
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
(localhost,57637,t,t)
|
|
||||||
(localhost,57638,t,t)
|
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
-- ctes with volatile functions are not
|
-- ctes with volatile functions are not
|
||||||
-- inlined
|
-- inlined
|
||||||
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
||||||
|
|
|
@ -636,21 +636,6 @@ Aggregate
|
||||||
-> Seq Scan on events_1400285 events
|
-> Seq Scan on events_1400285 events
|
||||||
Filter: ((event_type)::text = ANY ('{click,submit,pay}'::text[]))
|
Filter: ((event_type)::text = ANY ('{click,submit,pay}'::text[]))
|
||||||
-- Union and left join subquery pushdown
|
-- Union and left join subquery pushdown
|
||||||
-- enable_group_by_reordering is a new GUC introduced in PG15
|
|
||||||
-- it does some optimization of the order of group by keys which results
|
|
||||||
-- in a different explain output plan between PG13/14 and PG15
|
|
||||||
-- Hence we set that GUC to off.
|
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15
|
|
||||||
\gset
|
|
||||||
\if :server_version_ge_15
|
|
||||||
SET enable_group_by_reordering TO off;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM SET enable_group_by_reordering TO off;$$);
|
|
||||||
1
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
(localhost,57637,t,t)
|
|
||||||
(localhost,57638,t,t)
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT
|
SELECT
|
||||||
avg(array_length(events, 1)) AS event_average,
|
avg(array_length(events, 1)) AS event_average,
|
||||||
|
@ -873,14 +858,6 @@ Sort
|
||||||
Sort Key: events_2.composite_id
|
Sort Key: events_2.composite_id
|
||||||
-> Seq Scan on events_1400285 events_2
|
-> Seq Scan on events_1400285 events_2
|
||||||
Filter: ((composite_id >= '(1,-9223372036854775808)'::user_composite_type) AND (composite_id <= '(1,9223372036854775807)'::user_composite_type) AND ((event_type)::text = 'pay'::text))
|
Filter: ((composite_id >= '(1,-9223372036854775808)'::user_composite_type) AND (composite_id <= '(1,9223372036854775807)'::user_composite_type) AND ((event_type)::text = 'pay'::text))
|
||||||
\if :server_version_ge_15
|
|
||||||
RESET enable_group_by_reordering;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM RESET enable_group_by_reordering;$$);
|
|
||||||
1
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
(localhost,57637,t,t)
|
|
||||||
(localhost,57638,t,t)
|
|
||||||
-- Lateral join subquery pushdown
|
-- Lateral join subquery pushdown
|
||||||
-- set subquery_pushdown due to limit in the query
|
-- set subquery_pushdown due to limit in the query
|
||||||
SET citus.subquery_pushdown to ON;
|
SET citus.subquery_pushdown to ON;
|
||||||
|
|
|
@ -3,13 +3,6 @@
|
||||||
--
|
--
|
||||||
-- Tests select distinct, and select distinct on features.
|
-- Tests select distinct, and select distinct on features.
|
||||||
--
|
--
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15;
|
|
||||||
server_version_ge_15
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
t
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
ANALYZE lineitem_hash_part;
|
ANALYZE lineitem_hash_part;
|
||||||
-- function calls are supported
|
-- function calls are supported
|
||||||
SELECT DISTINCT l_orderkey, now() FROM lineitem_hash_part LIMIT 0;
|
SELECT DISTINCT l_orderkey, now() FROM lineitem_hash_part LIMIT 0;
|
||||||
|
@ -446,10 +439,9 @@ EXPLAIN (COSTS FALSE)
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
|
-> Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: remote_scan.l_suppkey, ((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))
|
Sort Key: remote_scan.l_suppkey, ((pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1)))
|
||||||
-> HashAggregate
|
|
||||||
Group Key: remote_scan.l_suppkey, (pg_catalog.sum(remote_scan.avg) / pg_catalog.sum(remote_scan.avg_1))
|
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: remote_scan.l_suppkey, remote_scan.worker_column_4
|
Group Key: remote_scan.l_suppkey, remote_scan.worker_column_4
|
||||||
-> Custom Scan (Citus Adaptive)
|
-> Custom Scan (Citus Adaptive)
|
||||||
|
@ -460,7 +452,7 @@ EXPLAIN (COSTS FALSE)
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: l_suppkey, l_linenumber
|
Group Key: l_suppkey, l_linenumber
|
||||||
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
||||||
(15 rows)
|
(14 rows)
|
||||||
|
|
||||||
-- check the plan if the hash aggreate is disabled. This explain errors out due
|
-- check the plan if the hash aggreate is disabled. This explain errors out due
|
||||||
-- to a bug right now, expectation must be corrected after fixing it.
|
-- to a bug right now, expectation must be corrected after fixing it.
|
||||||
|
@ -598,10 +590,9 @@ EXPLAIN (COSTS FALSE)
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
|
-> Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: ((sum(remote_scan.avg) / (pg_catalog.sum(remote_scan.avg_1))::double precision))
|
Sort Key: ((sum(remote_scan.avg) / (pg_catalog.sum(remote_scan.avg_1))::double precision))
|
||||||
-> HashAggregate
|
|
||||||
Group Key: (sum(remote_scan.avg) / (pg_catalog.sum(remote_scan.avg_1))::double precision)
|
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: remote_scan.worker_column_3, remote_scan.worker_column_4
|
Group Key: remote_scan.worker_column_3, remote_scan.worker_column_4
|
||||||
-> Custom Scan (Citus Adaptive)
|
-> Custom Scan (Citus Adaptive)
|
||||||
|
@ -612,7 +603,7 @@ EXPLAIN (COSTS FALSE)
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: l_suppkey, l_linenumber
|
Group Key: l_suppkey, l_linenumber
|
||||||
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
||||||
(15 rows)
|
(14 rows)
|
||||||
|
|
||||||
-- check the plan if the hash aggreate is disabled. This explain errors out due
|
-- check the plan if the hash aggreate is disabled. This explain errors out due
|
||||||
-- to a bug right now, expectation must be corrected after fixing it.
|
-- to a bug right now, expectation must be corrected after fixing it.
|
||||||
|
@ -674,10 +665,9 @@ EXPLAIN (COSTS FALSE)
|
||||||
QUERY PLAN
|
QUERY PLAN
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
|
-> Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
Sort Key: (((pg_catalog.sum(remote_scan.dis))::bigint + COALESCE((pg_catalog.sum(remote_scan.dis_1))::bigint, '0'::bigint)))
|
Sort Key: (((pg_catalog.sum(remote_scan.dis))::bigint + COALESCE((pg_catalog.sum(remote_scan.dis_1))::bigint, '0'::bigint)))
|
||||||
-> HashAggregate
|
|
||||||
Group Key: ((pg_catalog.sum(remote_scan.dis))::bigint + COALESCE((pg_catalog.sum(remote_scan.dis_1))::bigint, '0'::bigint))
|
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: remote_scan.worker_column_3, remote_scan.worker_column_4
|
Group Key: remote_scan.worker_column_3, remote_scan.worker_column_4
|
||||||
-> Custom Scan (Citus Adaptive)
|
-> Custom Scan (Citus Adaptive)
|
||||||
|
@ -688,7 +678,7 @@ EXPLAIN (COSTS FALSE)
|
||||||
-> HashAggregate
|
-> HashAggregate
|
||||||
Group Key: l_suppkey, l_linenumber
|
Group Key: l_suppkey, l_linenumber
|
||||||
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
-> Seq Scan on lineitem_hash_part_360041 lineitem_hash_part
|
||||||
(15 rows)
|
(14 rows)
|
||||||
|
|
||||||
-- check the plan if the hash aggreate is disabled. This explain errors out due
|
-- check the plan if the hash aggreate is disabled. This explain errors out due
|
||||||
-- to a bug right now, expectation must be corrected after fixing it.
|
-- to a bug right now, expectation must be corrected after fixing it.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -246,19 +246,6 @@ $Q$);
|
||||||
|
|
||||||
\set VERBOSITY default
|
\set VERBOSITY default
|
||||||
|
|
||||||
-- enable_group_by_reordering is a new GUC introduced in PG15
|
|
||||||
-- it does some optimization of the order of group by keys which results
|
|
||||||
-- in a different explain output plan between PG13/14 and PG15
|
|
||||||
-- Hence we set that GUC to off.
|
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15
|
|
||||||
\gset
|
|
||||||
\if :server_version_ge_15
|
|
||||||
SET enable_group_by_reordering TO off;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM SET enable_group_by_reordering TO off;$$);
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF) WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
EXPLAIN (COSTS OFF) WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
|
@ -268,13 +255,6 @@ FROM
|
||||||
cte_1 as second_entry
|
cte_1 as second_entry
|
||||||
USING (key);
|
USING (key);
|
||||||
|
|
||||||
\if :server_version_ge_15
|
|
||||||
RESET enable_group_by_reordering;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM RESET enable_group_by_reordering;$$);
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
|
|
||||||
|
|
||||||
-- ctes with volatile functions are not
|
-- ctes with volatile functions are not
|
||||||
-- inlined
|
-- inlined
|
||||||
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
||||||
|
|
|
@ -254,20 +254,6 @@ FROM
|
||||||
user_id) AS subquery;
|
user_id) AS subquery;
|
||||||
|
|
||||||
-- Union and left join subquery pushdown
|
-- Union and left join subquery pushdown
|
||||||
|
|
||||||
-- enable_group_by_reordering is a new GUC introduced in PG15
|
|
||||||
-- it does some optimization of the order of group by keys which results
|
|
||||||
-- in a different explain output plan between PG13/14 and PG15
|
|
||||||
-- Hence we set that GUC to off.
|
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15
|
|
||||||
\gset
|
|
||||||
\if :server_version_ge_15
|
|
||||||
SET enable_group_by_reordering TO off;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM SET enable_group_by_reordering TO off;$$);
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
|
|
||||||
EXPLAIN (COSTS OFF)
|
EXPLAIN (COSTS OFF)
|
||||||
SELECT
|
SELECT
|
||||||
avg(array_length(events, 1)) AS event_average,
|
avg(array_length(events, 1)) AS event_average,
|
||||||
|
@ -403,12 +389,6 @@ GROUP BY
|
||||||
ORDER BY
|
ORDER BY
|
||||||
count_pay;
|
count_pay;
|
||||||
|
|
||||||
\if :server_version_ge_15
|
|
||||||
RESET enable_group_by_reordering;
|
|
||||||
\endif
|
|
||||||
SELECT DISTINCT 1 FROM run_command_on_workers($$ALTER SYSTEM RESET enable_group_by_reordering;$$);
|
|
||||||
SELECT run_command_on_workers($$SELECT pg_reload_conf()$$);
|
|
||||||
|
|
||||||
-- Lateral join subquery pushdown
|
-- Lateral join subquery pushdown
|
||||||
-- set subquery_pushdown due to limit in the query
|
-- set subquery_pushdown due to limit in the query
|
||||||
SET citus.subquery_pushdown to ON;
|
SET citus.subquery_pushdown to ON;
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
--
|
--
|
||||||
-- Tests select distinct, and select distinct on features.
|
-- Tests select distinct, and select distinct on features.
|
||||||
--
|
--
|
||||||
SHOW server_version \gset
|
|
||||||
SELECT substring(:'server_version', '\d+')::int >= 15 AS server_version_ge_15;
|
|
||||||
|
|
||||||
ANALYZE lineitem_hash_part;
|
ANALYZE lineitem_hash_part;
|
||||||
|
|
||||||
-- function calls are supported
|
-- function calls are supported
|
||||||
|
|
Loading…
Reference in New Issue