mirror of https://github.com/citusdata/citus.git
PG17 regress sanity: Fix test diffs in columnar schedule
parent
c396ce60a0
commit
80658d1783
|
@ -977,6 +977,7 @@ DETAIL: unparameterized; 1 clauses pushed down
|
|||
(1 row)
|
||||
|
||||
SET hash_mem_multiplier = 1.0;
|
||||
SELECT public.explain_with_pg16_subplan_format($Q$
|
||||
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||
SELECT sum(a) FROM pushdown_test where
|
||||
(
|
||||
|
@ -989,13 +990,18 @@ SELECT sum(a) FROM pushdown_test where
|
|||
)
|
||||
or
|
||||
(a > 200000-2010);
|
||||
$Q$) as "QUERY PLAN";
|
||||
NOTICE: columnar planner: adding CustomScan path for pushdown_test
|
||||
DETAIL: unparameterized; 0 clauses pushed down
|
||||
CONTEXT: PL/pgSQL function explain_with_pg16_subplan_format(text) line XX at FOR over EXECUTE statement
|
||||
NOTICE: columnar planner: cannot push down clause: must match 'Var <op> Expr' or 'Expr <op> Var'
|
||||
HINT: Var must only reference this rel, and Expr must not reference this rel
|
||||
CONTEXT: PL/pgSQL function explain_with_pg16_subplan_format(text) line XX at FOR over EXECUTE statement
|
||||
NOTICE: columnar planner: cannot push down clause: must not contain a subplan
|
||||
CONTEXT: PL/pgSQL function explain_with_pg16_subplan_format(text) line XX at FOR over EXECUTE statement
|
||||
NOTICE: columnar planner: adding CustomScan path for pushdown_test
|
||||
DETAIL: unparameterized; 1 clauses pushed down
|
||||
CONTEXT: PL/pgSQL function explain_with_pg16_subplan_format(text) line XX at FOR over EXECUTE statement
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Aggregate (actual rows=1 loops=1)
|
||||
|
@ -1092,14 +1098,14 @@ BEGIN;
|
|||
END;
|
||||
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||
SELECT id FROM pushdown_test WHERE country IN ('USA', 'BR', 'ZW');
|
||||
QUERY PLAN
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Custom Scan (ColumnarScan) on pushdown_test (actual rows=3 loops=1)
|
||||
Filter: (country = ANY ('{USA,BR,ZW}'::text[]))
|
||||
Rows Removed by Filter: 1
|
||||
Columnar Projected Columns: id, country
|
||||
Columnar Chunk Group Filters: (country = ANY ('{USA,BR,ZW}'::text[]))
|
||||
Columnar Chunk Groups Removed by Filter: 2
|
||||
Filter: (country = ANY ('{USA,BR,ZW}'::text[]))
|
||||
Rows Removed by Filter: 1
|
||||
Columnar Projected Columns: id, country
|
||||
Columnar Chunk Group Filters: (country = ANY ('{USA,BR,ZW}'::text[]))
|
||||
Columnar Chunk Groups Removed by Filter: 2
|
||||
(6 rows)
|
||||
|
||||
SELECT id FROM pushdown_test WHERE country IN ('USA', 'BR', 'ZW');
|
||||
|
|
|
@ -290,27 +290,28 @@ BEGIN;
|
|||
(16 rows)
|
||||
|
||||
ROLLBACK;
|
||||
-- Force nested loop join to ensure the next query has a
|
||||
-- consistent plan across pg versions
|
||||
set enable_hashjoin to 0;
|
||||
set enable_mergejoin to 0;
|
||||
-- use custom scan
|
||||
EXPLAIN (COSTS OFF) WITH w AS (SELECT * FROM full_correlated)
|
||||
SELECT * FROM w AS w1 JOIN w AS w2 ON w1.a = w2.d
|
||||
WHERE w2.a = 123;
|
||||
QUERY PLAN
|
||||
---------------------------------------------------------------------
|
||||
Merge Join
|
||||
Merge Cond: (w2.d = w1.a)
|
||||
Nested Loop
|
||||
Join Filter: (w1.a = w2.d)
|
||||
CTE w
|
||||
-> Custom Scan (ColumnarScan) on full_correlated
|
||||
Columnar Projected Columns: a, b, c, d
|
||||
-> Sort
|
||||
Sort Key: w2.d
|
||||
-> CTE Scan on w w2
|
||||
Filter: (a = 123)
|
||||
-> Materialize
|
||||
-> Sort
|
||||
Sort Key: w1.a
|
||||
-> CTE Scan on w w1
|
||||
(13 rows)
|
||||
-> CTE Scan on w w2
|
||||
Filter: (a = 123)
|
||||
-> CTE Scan on w w1
|
||||
(8 rows)
|
||||
|
||||
reset enable_hashjoin;
|
||||
reset enable_mergejoin;
|
||||
-- use index
|
||||
EXPLAIN (COSTS OFF) WITH w AS NOT MATERIALIZED (SELECT * FROM full_correlated)
|
||||
SELECT * FROM w AS w1 JOIN w AS w2 ON w1.a = w2.d
|
||||
|
|
|
@ -585,3 +585,23 @@ BEGIN
|
|||
RETURN NEXT;
|
||||
END LOOP;
|
||||
END; $$ language plpgsql;
|
||||
-- This function formats EXPLAIN output to conform to how pg <= 16 EXPLAIN
|
||||
-- shows ANY <subquery> in an expression the pg version >= 17. When 17 is
|
||||
-- the minimum supported pgversion this function can be retired. The commit
|
||||
-- that changed how ANY <subquery> exrpressions appear in EXPLAIN is:
|
||||
-- https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fd0398fcb
|
||||
CREATE OR REPLACE FUNCTION explain_with_pg16_subplan_format(explain_command text, out query_plan text)
|
||||
RETURNS SETOF TEXT AS $$
|
||||
DECLARE
|
||||
pgversion int = 0;
|
||||
BEGIN
|
||||
pgversion = substring(version(), '\d+')::int ;
|
||||
FOR query_plan IN execute explain_command LOOP
|
||||
IF pgversion >= 17 THEN
|
||||
IF query_plan ~ 'SubPlan \d+\).col' THEN
|
||||
query_plan = regexp_replace(query_plan, '\(ANY \(\w+ = \(SubPlan (\d+)\).col1\)\)', '(SubPlan \1)', 'g');
|
||||
END IF;
|
||||
END IF;
|
||||
RETURN NEXT;
|
||||
END LOOP;
|
||||
END; $$ language plpgsql;
|
||||
|
|
|
@ -415,6 +415,7 @@ SELECT sum(a) FROM pushdown_test where (a > random() and a <= 2000) or (a > 2000
|
|||
SELECT sum(a) FROM pushdown_test where (a > random() and a <= 2000) or (a > 200000-1010);
|
||||
|
||||
SET hash_mem_multiplier = 1.0;
|
||||
SELECT public.explain_with_pg16_subplan_format($Q$
|
||||
EXPLAIN (analyze on, costs off, timing off, summary off)
|
||||
SELECT sum(a) FROM pushdown_test where
|
||||
(
|
||||
|
@ -427,6 +428,7 @@ SELECT sum(a) FROM pushdown_test where
|
|||
)
|
||||
or
|
||||
(a > 200000-2010);
|
||||
$Q$) as "QUERY PLAN";
|
||||
RESET hash_mem_multiplier;
|
||||
SELECT sum(a) FROM pushdown_test where
|
||||
(
|
||||
|
|
|
@ -181,11 +181,19 @@ BEGIN;
|
|||
WHERE ct_1.a < 3000;
|
||||
ROLLBACK;
|
||||
|
||||
-- Force nested loop join to ensure the next query has a
|
||||
-- consistent plan across pg versions
|
||||
set enable_hashjoin to 0;
|
||||
set enable_mergejoin to 0;
|
||||
|
||||
-- use custom scan
|
||||
EXPLAIN (COSTS OFF) WITH w AS (SELECT * FROM full_correlated)
|
||||
SELECT * FROM w AS w1 JOIN w AS w2 ON w1.a = w2.d
|
||||
WHERE w2.a = 123;
|
||||
|
||||
reset enable_hashjoin;
|
||||
reset enable_mergejoin;
|
||||
|
||||
-- use index
|
||||
EXPLAIN (COSTS OFF) WITH w AS NOT MATERIALIZED (SELECT * FROM full_correlated)
|
||||
SELECT * FROM w AS w1 JOIN w AS w2 ON w1.a = w2.d
|
||||
|
|
|
@ -611,3 +611,24 @@ BEGIN
|
|||
RETURN NEXT;
|
||||
END LOOP;
|
||||
END; $$ language plpgsql;
|
||||
|
||||
-- This function formats EXPLAIN output to conform to how pg <= 16 EXPLAIN
|
||||
-- shows ANY <subquery> in an expression the pg version >= 17. When 17 is
|
||||
-- the minimum supported pgversion this function can be retired. The commit
|
||||
-- that changed how ANY <subquery> exrpressions appear in EXPLAIN is:
|
||||
-- https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fd0398fcb
|
||||
CREATE OR REPLACE FUNCTION explain_with_pg16_subplan_format(explain_command text, out query_plan text)
|
||||
RETURNS SETOF TEXT AS $$
|
||||
DECLARE
|
||||
pgversion int = 0;
|
||||
BEGIN
|
||||
pgversion = substring(version(), '\d+')::int ;
|
||||
FOR query_plan IN execute explain_command LOOP
|
||||
IF pgversion >= 17 THEN
|
||||
IF query_plan ~ 'SubPlan \d+\).col' THEN
|
||||
query_plan = regexp_replace(query_plan, '\(ANY \(\w+ = \(SubPlan (\d+)\).col1\)\)', '(SubPlan \1)', 'g');
|
||||
END IF;
|
||||
END IF;
|
||||
RETURN NEXT;
|
||||
END LOOP;
|
||||
END; $$ language plpgsql;
|
||||
|
|
Loading…
Reference in New Issue