mirror of https://github.com/citusdata/citus.git
Handles EXPLAIN output diffs in PG15: enable_group_by_reordering
Relevant PG commit db0d67db2401eb6238ccc04c6407a4fd4f985832naisila/failure_pg15
parent
2aa07e37a4
commit
8b141aef13
|
@ -449,6 +449,29 @@ DEBUG: Creating router plan
|
|||
(5 rows)
|
||||
|
||||
\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 > 14 AS server_version_above_fourteen
|
||||
\gset
|
||||
\if :server_version_above_fourteen
|
||||
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)
|
||||
SELECT
|
||||
count(*)
|
||||
|
@ -487,6 +510,22 @@ DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
|||
-> Seq Scan on test_table_1960000 test_table_1
|
||||
(12 rows)
|
||||
|
||||
\if :server_version_above_fourteen
|
||||
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
|
||||
-- inlined
|
||||
WITH cte_1 AS (SELECT *, random() FROM test_table)
|
||||
|
|
|
@ -632,6 +632,21 @@ Aggregate
|
|||
-> Seq Scan on events_1400285 events
|
||||
Filter: ((event_type)::text = ANY ('{click,submit,pay}'::text[]))
|
||||
-- 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 > 14 AS server_version_above_fourteen
|
||||
\gset
|
||||
\if :server_version_above_fourteen
|
||||
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)
|
||||
SELECT
|
||||
avg(array_length(events, 1)) AS event_average,
|
||||
|
@ -854,6 +869,14 @@ Sort
|
|||
Sort Key: events_2.composite_id
|
||||
-> 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))
|
||||
\if :server_version_above_fourteen
|
||||
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
|
||||
-- set subquery_pushdown due to limit in the query
|
||||
SET citus.subquery_pushdown to ON;
|
||||
|
|
|
@ -236,6 +236,19 @@ $Q$);
|
|||
|
||||
\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 > 14 AS server_version_above_fourteen
|
||||
\gset
|
||||
\if :server_version_above_fourteen
|
||||
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)
|
||||
SELECT
|
||||
count(*)
|
||||
|
@ -245,6 +258,11 @@ FROM
|
|||
cte_1 as second_entry
|
||||
USING (key);
|
||||
|
||||
\if :server_version_above_fourteen
|
||||
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
|
||||
|
|
|
@ -250,6 +250,20 @@ FROM
|
|||
user_id) AS subquery;
|
||||
|
||||
-- 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 > 14 AS server_version_above_fourteen
|
||||
\gset
|
||||
\if :server_version_above_fourteen
|
||||
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)
|
||||
SELECT
|
||||
avg(array_length(events, 1)) AS event_average,
|
||||
|
@ -385,6 +399,12 @@ GROUP BY
|
|||
ORDER BY
|
||||
count_pay;
|
||||
|
||||
\if :server_version_above_fourteen
|
||||
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
|
||||
-- set subquery_pushdown due to limit in the query
|
||||
SET citus.subquery_pushdown to ON;
|
||||
|
|
Loading…
Reference in New Issue