mirror of https://github.com/citusdata/citus.git
Handles EXPLAIN output diffs in PG15 - Extra result lines
To handle extra "Result" lines in explain outputs, we add explain method to multi_test_helpers.sql file - plan_without_result_lines() is added for cases where we want the whole explain output with only "Result" lines removedpg_15_iso_fix
parent
d54b4f2268
commit
f69beb541f
|
@ -957,13 +957,16 @@ SELECT * FROM weird_col_explain;
|
||||||
Columnar Projected Columns: "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb", "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'"
|
Columnar Projected Columns: "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb", "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'"
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
|
\set VERBOSITY terse
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
||||||
SELECT *, "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb"
|
SELECT *, "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb"
|
||||||
FROM weird_col_explain
|
FROM weird_col_explain
|
||||||
WHERE "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb" * 2 >
|
WHERE "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb" * 2 >
|
||||||
"aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'!";
|
"aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'!";
|
||||||
|
$Q$);
|
||||||
NOTICE: identifier "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'!" will be truncated to "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'"
|
NOTICE: identifier "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'!" will be truncated to "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'"
|
||||||
QUERY PLAN
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Custom Scan (Citus Adaptive)
|
Custom Scan (Citus Adaptive)
|
||||||
Task Count: 4
|
Task Count: 4
|
||||||
|
@ -975,6 +978,7 @@ NOTICE: identifier "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa
|
||||||
Columnar Projected Columns: "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb", "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'"
|
Columnar Projected Columns: "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb", "aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'"
|
||||||
(8 rows)
|
(8 rows)
|
||||||
|
|
||||||
|
\set VERBOSITY default
|
||||||
-- should not project any columns
|
-- should not project any columns
|
||||||
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
||||||
SELECT COUNT(*) FROM weird_col_explain;
|
SELECT COUNT(*) FROM weird_col_explain;
|
||||||
|
|
|
@ -1254,8 +1254,10 @@ NOTICE: copying the data has completed
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
explain (costs off) insert into table_with_sequences select y, x from table_with_sequences;
|
explain (costs off) insert into table_with_sequences select y, x from table_with_sequences;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Custom Scan (Citus INSERT ... SELECT)
|
Custom Scan (Citus INSERT ... SELECT)
|
||||||
INSERT/SELECT method: pull to coordinator
|
INSERT/SELECT method: pull to coordinator
|
||||||
|
@ -1280,8 +1282,10 @@ NOTICE: copying the data has completed
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
explain (costs off) insert into table_with_user_sequences select y, x from table_with_user_sequences;
|
explain (costs off) insert into table_with_user_sequences select y, x from table_with_user_sequences;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Custom Scan (Citus INSERT ... SELECT)
|
Custom Scan (Citus INSERT ... SELECT)
|
||||||
INSERT/SELECT method: pull to coordinator
|
INSERT/SELECT method: pull to coordinator
|
||||||
|
|
|
@ -306,12 +306,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique
|
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique
|
||||||
-- instead of aggregate plan node to handle distinct.
|
-- instead of aggregate plan node to handle distinct.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT count(*)
|
SELECT DISTINCT count(*)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
|
@ -380,13 +382,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. Similar to the explain of
|
-- check the plan if the hash aggreate is disabled. Similar to the explain of
|
||||||
-- the query above.
|
-- the query above.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT l_suppkey, count(*)
|
SELECT DISTINCT l_suppkey, count(*)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -457,13 +461,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT l_suppkey, avg(l_partkey)
|
SELECT DISTINCT l_suppkey, avg(l_partkey)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1,2
|
ORDER BY 1,2
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -533,13 +539,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique to
|
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique to
|
||||||
-- handle distinct on.
|
-- handle distinct on.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (l_suppkey) avg(l_partkey)
|
SELECT DISTINCT ON (l_suppkey) avg(l_partkey)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY l_suppkey,1
|
ORDER BY l_suppkey,1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -608,13 +616,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT avg(ceil(l_partkey / 2))
|
SELECT DISTINCT avg(ceil(l_partkey / 2))
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -683,13 +693,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT sum(l_suppkey) + count(l_partkey) AS dis
|
SELECT DISTINCT sum(l_suppkey) + count(l_partkey) AS dis
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -914,12 +926,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
|
|
||||||
-- check the plan if the hash aggreate is disabled
|
-- check the plan if the hash aggreate is disabled
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ceil(count(case when l_partkey > 100000 THEN 1 ELSE 0 END) / 2) AS count
|
SELECT DISTINCT ceil(count(case when l_partkey > 100000 THEN 1 ELSE 0 END) / 2) AS count
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey
|
GROUP BY l_suppkey
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
|
|
|
@ -306,12 +306,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique
|
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique
|
||||||
-- instead of aggregate plan node to handle distinct.
|
-- instead of aggregate plan node to handle distinct.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT count(*)
|
SELECT DISTINCT count(*)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
|
@ -380,13 +382,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. Similar to the explain of
|
-- check the plan if the hash aggreate is disabled. Similar to the explain of
|
||||||
-- the query above.
|
-- the query above.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT l_suppkey, count(*)
|
SELECT DISTINCT l_suppkey, count(*)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -457,13 +461,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT l_suppkey, avg(l_partkey)
|
SELECT DISTINCT l_suppkey, avg(l_partkey)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1,2
|
ORDER BY 1,2
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -533,13 +539,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique to
|
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique to
|
||||||
-- handle distinct on.
|
-- handle distinct on.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (l_suppkey) avg(l_partkey)
|
SELECT DISTINCT ON (l_suppkey) avg(l_partkey)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY l_suppkey,1
|
ORDER BY l_suppkey,1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -608,13 +616,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT avg(ceil(l_partkey / 2))
|
SELECT DISTINCT avg(ceil(l_partkey / 2))
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -683,13 +693,15 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT sum(l_suppkey) + count(l_partkey) AS dis
|
SELECT DISTINCT sum(l_suppkey) + count(l_partkey) AS dis
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> Unique
|
-> Unique
|
||||||
|
@ -914,12 +926,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
|
|
||||||
-- check the plan if the hash aggreate is disabled
|
-- check the plan if the hash aggreate is disabled
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ceil(count(case when l_partkey > 100000 THEN 1 ELSE 0 END) / 2) AS count
|
SELECT DISTINCT ceil(count(case when l_partkey > 100000 THEN 1 ELSE 0 END) / 2) AS count
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey
|
GROUP BY l_suppkey
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Unique
|
Unique
|
||||||
-> Sort
|
-> Sort
|
||||||
|
|
|
@ -29,6 +29,19 @@ BEGIN
|
||||||
END LOOP;
|
END LOOP;
|
||||||
RETURN;
|
RETURN;
|
||||||
END; $$ language plpgsql;
|
END; $$ language plpgsql;
|
||||||
|
-- Create a function to ignore "-> Result" lines for PG15 support
|
||||||
|
-- In PG15 there are some extra "-> Result" lines
|
||||||
|
CREATE OR REPLACE FUNCTION plan_without_result_lines(explain_command text, out query_plan text)
|
||||||
|
RETURNS SETOF TEXT AS $$
|
||||||
|
BEGIN
|
||||||
|
FOR query_plan IN execute explain_command LOOP
|
||||||
|
IF (query_plan LIKE '%-> Result%' OR query_plan = 'Result') THEN
|
||||||
|
CONTINUE;
|
||||||
|
END IF;
|
||||||
|
RETURN next;
|
||||||
|
END LOOP;
|
||||||
|
RETURN;
|
||||||
|
END; $$ language plpgsql;
|
||||||
-- helper function that returns true if output of given explain has "is not null" (case in-sensitive)
|
-- helper function that returns true if output of given explain has "is not null" (case in-sensitive)
|
||||||
CREATE OR REPLACE FUNCTION explain_has_is_not_null(explain_command text)
|
CREATE OR REPLACE FUNCTION explain_has_is_not_null(explain_command text)
|
||||||
RETURNS BOOLEAN AS $$
|
RETURNS BOOLEAN AS $$
|
||||||
|
|
|
@ -1506,10 +1506,12 @@ LIMIT 5;
|
||||||
(22 rows)
|
(22 rows)
|
||||||
|
|
||||||
-- Grouping can be pushed down with aggregates even when window function can't
|
-- Grouping can be pushed down with aggregates even when window function can't
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
||||||
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> WindowAgg
|
-> WindowAgg
|
||||||
|
|
|
@ -1490,10 +1490,12 @@ LIMIT 5;
|
||||||
(18 rows)
|
(18 rows)
|
||||||
|
|
||||||
-- Grouping can be pushed down with aggregates even when window function can't
|
-- Grouping can be pushed down with aggregates even when window function can't
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
||||||
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> WindowAgg
|
-> WindowAgg
|
||||||
|
|
|
@ -1486,10 +1486,12 @@ LIMIT 5;
|
||||||
(17 rows)
|
(17 rows)
|
||||||
|
|
||||||
-- Grouping can be pushed down with aggregates even when window function can't
|
-- Grouping can be pushed down with aggregates even when window function can't
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
||||||
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
||||||
QUERY PLAN
|
$Q$);
|
||||||
|
plan_without_result_lines
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
Limit
|
Limit
|
||||||
-> WindowAgg
|
-> WindowAgg
|
||||||
|
|
|
@ -428,11 +428,15 @@ SELECT create_distributed_table('weird_col_explain', 'bbbbbbbbbbbbbbbbbbbbbbbbb\
|
||||||
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
||||||
SELECT * FROM weird_col_explain;
|
SELECT * FROM weird_col_explain;
|
||||||
|
|
||||||
|
\set VERBOSITY terse
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
||||||
SELECT *, "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb"
|
SELECT *, "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb"
|
||||||
FROM weird_col_explain
|
FROM weird_col_explain
|
||||||
WHERE "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb" * 2 >
|
WHERE "bbbbbbbbbbbbbbbbbbbbbbbbb\!bbbb'bbbbbbbbbbbbbbbbbbbbb''bbbbbbbb" * 2 >
|
||||||
"aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'!";
|
"aaaaaaaaaaaa$aaaaaa$$aaaaaaaaaaaaaaaaaaaaaaaaaaaaa'aaaaaaaa'$a'!";
|
||||||
|
$Q$);
|
||||||
|
\set VERBOSITY default
|
||||||
|
|
||||||
-- should not project any columns
|
-- should not project any columns
|
||||||
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
EXPLAIN (COSTS OFF, SUMMARY OFF)
|
||||||
|
|
|
@ -623,7 +623,9 @@ DO UPDATE SET
|
||||||
create table table_with_sequences (x int, y int, z bigserial);
|
create table table_with_sequences (x int, y int, z bigserial);
|
||||||
insert into table_with_sequences values (1,1);
|
insert into table_with_sequences values (1,1);
|
||||||
select create_distributed_table('table_with_sequences','x');
|
select create_distributed_table('table_with_sequences','x');
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
explain (costs off) insert into table_with_sequences select y, x from table_with_sequences;
|
explain (costs off) insert into table_with_sequences select y, x from table_with_sequences;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
-- verify that we don't report repartitioned insert/select for tables
|
-- verify that we don't report repartitioned insert/select for tables
|
||||||
-- with user-defined sequences.
|
-- with user-defined sequences.
|
||||||
|
@ -631,7 +633,9 @@ CREATE SEQUENCE user_defined_sequence;
|
||||||
create table table_with_user_sequences (x int, y int, z bigint default nextval('user_defined_sequence'));
|
create table table_with_user_sequences (x int, y int, z bigint default nextval('user_defined_sequence'));
|
||||||
insert into table_with_user_sequences values (1,1);
|
insert into table_with_user_sequences values (1,1);
|
||||||
select create_distributed_table('table_with_user_sequences','x');
|
select create_distributed_table('table_with_user_sequences','x');
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
explain (costs off) insert into table_with_user_sequences select y, x from table_with_user_sequences;
|
explain (costs off) insert into table_with_user_sequences select y, x from table_with_user_sequences;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
-- clean-up
|
-- clean-up
|
||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
|
|
|
@ -113,11 +113,13 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique
|
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique
|
||||||
-- instead of aggregate plan node to handle distinct.
|
-- instead of aggregate plan node to handle distinct.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT count(*)
|
SELECT DISTINCT count(*)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
@ -140,12 +142,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. Similar to the explain of
|
-- check the plan if the hash aggreate is disabled. Similar to the explain of
|
||||||
-- the query above.
|
-- the query above.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT l_suppkey, count(*)
|
SELECT DISTINCT l_suppkey, count(*)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
@ -169,12 +173,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT l_suppkey, avg(l_partkey)
|
SELECT DISTINCT l_suppkey, avg(l_partkey)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1,2
|
ORDER BY 1,2
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
@ -197,12 +203,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique to
|
-- check the plan if the hash aggreate is disabled. We expect to see sort+unique to
|
||||||
-- handle distinct on.
|
-- handle distinct on.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ON (l_suppkey) avg(l_partkey)
|
SELECT DISTINCT ON (l_suppkey) avg(l_partkey)
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY l_suppkey,1
|
ORDER BY l_suppkey,1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
@ -224,12 +232,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT avg(ceil(l_partkey / 2))
|
SELECT DISTINCT avg(ceil(l_partkey / 2))
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
@ -251,12 +261,14 @@ EXPLAIN (COSTS FALSE)
|
||||||
-- 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.
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT sum(l_suppkey) + count(l_partkey) AS dis
|
SELECT DISTINCT sum(l_suppkey) + count(l_partkey) AS dis
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey, l_linenumber
|
GROUP BY l_suppkey, l_linenumber
|
||||||
ORDER BY 1
|
ORDER BY 1
|
||||||
LIMIT 10;
|
LIMIT 10;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
@ -329,11 +341,13 @@ EXPLAIN (COSTS FALSE)
|
||||||
|
|
||||||
-- check the plan if the hash aggreate is disabled
|
-- check the plan if the hash aggreate is disabled
|
||||||
SET enable_hashagg TO off;
|
SET enable_hashagg TO off;
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT DISTINCT ceil(count(case when l_partkey > 100000 THEN 1 ELSE 0 END) / 2) AS count
|
SELECT DISTINCT ceil(count(case when l_partkey > 100000 THEN 1 ELSE 0 END) / 2) AS count
|
||||||
FROM lineitem_hash_part
|
FROM lineitem_hash_part
|
||||||
GROUP BY l_suppkey
|
GROUP BY l_suppkey
|
||||||
ORDER BY 1;
|
ORDER BY 1;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
SET enable_hashagg TO on;
|
SET enable_hashagg TO on;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,20 @@ BEGIN
|
||||||
RETURN;
|
RETURN;
|
||||||
END; $$ language plpgsql;
|
END; $$ language plpgsql;
|
||||||
|
|
||||||
|
-- Create a function to ignore "-> Result" lines for PG15 support
|
||||||
|
-- In PG15 there are some extra "-> Result" lines
|
||||||
|
CREATE OR REPLACE FUNCTION plan_without_result_lines(explain_command text, out query_plan text)
|
||||||
|
RETURNS SETOF TEXT AS $$
|
||||||
|
BEGIN
|
||||||
|
FOR query_plan IN execute explain_command LOOP
|
||||||
|
IF (query_plan LIKE '%-> Result%' OR query_plan = 'Result') THEN
|
||||||
|
CONTINUE;
|
||||||
|
END IF;
|
||||||
|
RETURN next;
|
||||||
|
END LOOP;
|
||||||
|
RETURN;
|
||||||
|
END; $$ language plpgsql;
|
||||||
|
|
||||||
-- helper function that returns true if output of given explain has "is not null" (case in-sensitive)
|
-- helper function that returns true if output of given explain has "is not null" (case in-sensitive)
|
||||||
CREATE OR REPLACE FUNCTION explain_has_is_not_null(explain_command text)
|
CREATE OR REPLACE FUNCTION explain_has_is_not_null(explain_command text)
|
||||||
RETURNS BOOLEAN AS $$
|
RETURNS BOOLEAN AS $$
|
||||||
|
|
|
@ -571,9 +571,11 @@ ORDER BY user_id, avg(value_1) DESC
|
||||||
LIMIT 5;
|
LIMIT 5;
|
||||||
|
|
||||||
-- Grouping can be pushed down with aggregates even when window function can't
|
-- Grouping can be pushed down with aggregates even when window function can't
|
||||||
|
SELECT public.plan_without_result_lines($Q$
|
||||||
EXPLAIN (COSTS FALSE)
|
EXPLAIN (COSTS FALSE)
|
||||||
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
SELECT user_id, count(value_1), stddev(value_1), count(user_id) OVER (PARTITION BY random())
|
||||||
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
FROM users_table GROUP BY user_id HAVING avg(value_1) > 2 LIMIT 1;
|
||||||
|
$Q$);
|
||||||
|
|
||||||
-- Window function with inlined CTE
|
-- Window function with inlined CTE
|
||||||
WITH cte as (
|
WITH cte as (
|
||||||
|
|
Loading…
Reference in New Issue