|
|
@ -12,10 +12,10 @@ INSERT INTO test_table SELECT i % 10, 'test' || i, row_to_json(row(i, i*18, 'tes
|
|
|
|
-- server version because CTE inlining might produce
|
|
|
|
-- server version because CTE inlining might produce
|
|
|
|
-- different debug messages in PG 11 vs PG 12
|
|
|
|
-- different debug messages in PG 11 vs PG 12
|
|
|
|
SHOW server_version \gset
|
|
|
|
SHOW server_version \gset
|
|
|
|
SELECT substring(:'server_version', '\d+')::int;
|
|
|
|
SELECT substring(:'server_version', '\d+')::int >= 12;
|
|
|
|
substring
|
|
|
|
?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
12
|
|
|
|
f
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
SET client_min_messages TO DEBUG;
|
|
|
|
SET client_min_messages TO DEBUG;
|
|
|
@ -48,19 +48,7 @@ SELECT
|
|
|
|
FROM
|
|
|
|
FROM
|
|
|
|
cte_1
|
|
|
|
cte_1
|
|
|
|
ORDER BY 2 DESC LIMIT 1;
|
|
|
|
ORDER BY 2 DESC LIMIT 1;
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE cte_1: SELECT key, value, other_value FROM cte_inline.test_table
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, other_value, (SELECT 1) FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_1 ORDER BY value DESC LIMIT 1
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
9 | test99 | {"f1": 99, "f2": 1782, "f3": "test99"} | 1
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- the cte can be inlined because the unsupported
|
|
|
|
-- the cte can be inlined because the unsupported
|
|
|
|
-- part of the query (subquery in WHERE clause)
|
|
|
|
-- part of the query (subquery in WHERE clause)
|
|
|
|
-- doesn't access the cte
|
|
|
|
-- doesn't access the cte
|
|
|
@ -304,9 +292,7 @@ FROM
|
|
|
|
WHERE
|
|
|
|
WHERE
|
|
|
|
key = 1;
|
|
|
|
key = 1;
|
|
|
|
DEBUG: CTE a is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE a is going to be inlined via distributed planning
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
DETAIL: distribution column value: 1
|
|
|
|
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
10
|
|
|
|
10
|
|
|
@ -320,15 +306,7 @@ FROM
|
|
|
|
a
|
|
|
|
a
|
|
|
|
WHERE
|
|
|
|
WHERE
|
|
|
|
key = 1;
|
|
|
|
key = 1;
|
|
|
|
DEBUG: CTE a is going to be inlined via distributed planning
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
DETAIL: distribution column value: 1
|
|
|
|
|
|
|
|
count
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- using MATERIALIZED should cause inlining not to happen
|
|
|
|
-- using MATERIALIZED should cause inlining not to happen
|
|
|
|
WITH a AS MATERIALIZED (SELECT * FROM test_table)
|
|
|
|
WITH a AS MATERIALIZED (SELECT * FROM test_table)
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
@ -337,17 +315,7 @@ FROM
|
|
|
|
a
|
|
|
|
a
|
|
|
|
WHERE
|
|
|
|
WHERE
|
|
|
|
key = 1;
|
|
|
|
key = 1;
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
ERROR: syntax error at or near "MATERIALIZED"
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE a: SELECT key, value, other_value FROM cte_inline.test_table
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) a WHERE (key OPERATOR(pg_catalog.=) 1)
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
count
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- EXPLAIN should show the difference between materialized an not materialized
|
|
|
|
-- EXPLAIN should show the difference between materialized an not materialized
|
|
|
|
EXPLAIN (COSTS OFF) WITH a AS (SELECT * FROM test_table)
|
|
|
|
EXPLAIN (COSTS OFF) WITH a AS (SELECT * FROM test_table)
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
@ -357,20 +325,19 @@ FROM
|
|
|
|
WHERE
|
|
|
|
WHERE
|
|
|
|
key = 1;
|
|
|
|
key = 1;
|
|
|
|
DEBUG: CTE a is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE a is going to be inlined via distributed planning
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
QUERY PLAN
|
|
|
|
DETAIL: distribution column value: 1
|
|
|
|
|
|
|
|
QUERY PLAN
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
Custom Scan (Citus Adaptive)
|
|
|
|
Aggregate
|
|
|
|
Task Count: 1
|
|
|
|
-> Custom Scan (Citus Adaptive)
|
|
|
|
Tasks Shown: All
|
|
|
|
Task Count: 4
|
|
|
|
-> Task
|
|
|
|
Tasks Shown: One of 4
|
|
|
|
Node: host=localhost port=xxxxx dbname=regression
|
|
|
|
-> Task
|
|
|
|
-> Aggregate
|
|
|
|
Node: host=localhost port=xxxxx dbname=regression
|
|
|
|
-> Seq Scan on test_table_1960000 test_table
|
|
|
|
-> Aggregate
|
|
|
|
Filter: (key = 1)
|
|
|
|
-> Seq Scan on test_table_1960000 test_table
|
|
|
|
(8 rows)
|
|
|
|
Filter: (key = 1)
|
|
|
|
|
|
|
|
(9 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXPLAIN (COSTS OFF) WITH a AS MATERIALIZED (SELECT * FROM test_table)
|
|
|
|
EXPLAIN (COSTS OFF) WITH a AS MATERIALIZED (SELECT * FROM test_table)
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
@ -379,31 +346,7 @@ FROM
|
|
|
|
a
|
|
|
|
a
|
|
|
|
WHERE
|
|
|
|
WHERE
|
|
|
|
key = 1;
|
|
|
|
key = 1;
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
ERROR: syntax error at or near "MATERIALIZED"
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE a: SELECT key, value, other_value FROM cte_inline.test_table
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) a WHERE (key OPERATOR(pg_catalog.=) 1)
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
QUERY PLAN
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
Custom Scan (Citus Adaptive)
|
|
|
|
|
|
|
|
-> Distributed Subplan XXX_1
|
|
|
|
|
|
|
|
-> Custom Scan (Citus Adaptive)
|
|
|
|
|
|
|
|
Task Count: 4
|
|
|
|
|
|
|
|
Tasks Shown: One of 4
|
|
|
|
|
|
|
|
-> Task
|
|
|
|
|
|
|
|
Node: host=localhost port=xxxxx dbname=regression
|
|
|
|
|
|
|
|
-> Seq Scan on test_table_1960000 test_table
|
|
|
|
|
|
|
|
Task Count: 1
|
|
|
|
|
|
|
|
Tasks Shown: All
|
|
|
|
|
|
|
|
-> Task
|
|
|
|
|
|
|
|
Node: host=localhost port=xxxxx dbname=regression
|
|
|
|
|
|
|
|
-> Aggregate
|
|
|
|
|
|
|
|
-> Function Scan on read_intermediate_result intermediate_result
|
|
|
|
|
|
|
|
Filter: (key = 1)
|
|
|
|
|
|
|
|
(15 rows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- citus should not inline the CTE because it is used multiple times
|
|
|
|
-- citus should not inline the CTE because it is used multiple times
|
|
|
|
WITH cte_1 AS (SELECT * FROM test_table)
|
|
|
|
WITH cte_1 AS (SELECT * FROM test_table)
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
@ -432,25 +375,7 @@ FROM
|
|
|
|
JOIN
|
|
|
|
JOIN
|
|
|
|
cte_1 as second_entry
|
|
|
|
cte_1 as second_entry
|
|
|
|
USING (key);
|
|
|
|
USING (key);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [0,1073741823]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [0,1073741823]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
|
|
|
|
|
|
|
count
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- EXPLAIN should show the differences between MATERIALIZED and NOT MATERIALIZED
|
|
|
|
-- EXPLAIN should show the differences between MATERIALIZED and NOT MATERIALIZED
|
|
|
|
EXPLAIN (COSTS OFF) WITH cte_1 AS (SELECT * FROM test_table)
|
|
|
|
EXPLAIN (COSTS OFF) WITH cte_1 AS (SELECT * FROM test_table)
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
@ -498,36 +423,7 @@ FROM
|
|
|
|
JOIN
|
|
|
|
JOIN
|
|
|
|
cte_1 as second_entry
|
|
|
|
cte_1 as second_entry
|
|
|
|
USING (key);
|
|
|
|
USING (key);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [0,1073741823]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [0,1073741823]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
|
|
|
|
|
|
|
QUERY PLAN
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
Aggregate
|
|
|
|
|
|
|
|
-> Custom Scan (Citus Adaptive)
|
|
|
|
|
|
|
|
Task Count: 4
|
|
|
|
|
|
|
|
Tasks Shown: One of 4
|
|
|
|
|
|
|
|
-> Task
|
|
|
|
|
|
|
|
Node: host=localhost port=xxxxx dbname=regression
|
|
|
|
|
|
|
|
-> Aggregate
|
|
|
|
|
|
|
|
-> Hash Join
|
|
|
|
|
|
|
|
Hash Cond: (test_table.key = test_table_1.key)
|
|
|
|
|
|
|
|
-> Seq Scan on test_table_1960000 test_table
|
|
|
|
|
|
|
|
-> Hash
|
|
|
|
|
|
|
|
-> Seq Scan on test_table_1960000 test_table_1
|
|
|
|
|
|
|
|
(12 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)
|
|
|
@ -552,17 +448,7 @@ SELECT
|
|
|
|
count(*)
|
|
|
|
count(*)
|
|
|
|
FROM
|
|
|
|
FROM
|
|
|
|
cte_1;
|
|
|
|
cte_1;
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE cte_1: SELECT key, value, other_value, random() AS random FROM cte_inline.test_table
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value, intermediate_result.random FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb, random double precision)) cte_1
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
count
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- cte_1 should be able to inlined even if
|
|
|
|
-- cte_1 should be able to inlined even if
|
|
|
|
-- it is used one level below
|
|
|
|
-- it is used one level below
|
|
|
|
WITH cte_1 AS (SELECT * FROM test_table)
|
|
|
|
WITH cte_1 AS (SELECT * FROM test_table)
|
|
|
@ -618,11 +504,11 @@ SELECT count(*)
|
|
|
|
LEFT JOIN test_table u2 ON u2.key = bar.key) AS foo ON TRUE;
|
|
|
|
LEFT JOIN test_table u2 ON u2.key = bar.key) AS foo ON TRUE;
|
|
|
|
DEBUG: CTE bar is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE bar is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
count
|
|
|
|
DEBUG: skipping recursive planning for the subquery since it contains references to outer queries
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
DEBUG: skipping recursive planning for the subquery since it contains references to outer queries
|
|
|
|
10331
|
|
|
|
DEBUG: skipping recursive planning for the subquery since it contains references to outer queries
|
|
|
|
(1 row)
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
ERROR: CTEs that refer to other subqueries are not supported in multi-shard queries
|
|
|
|
-- inlined CTE contains a reference to outer query
|
|
|
|
-- inlined CTE contains a reference to outer query
|
|
|
|
-- should be fine (even if the recursive planning fails
|
|
|
|
-- should be fine (even if the recursive planning fails
|
|
|
|
-- to recursively plan the query)
|
|
|
|
-- to recursively plan the query)
|
|
|
@ -695,9 +581,7 @@ DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
DETAIL: distribution column value: 1
|
|
|
|
|
|
|
|
count | key
|
|
|
|
count | key
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
(0 rows)
|
|
|
|
(0 rows)
|
|
|
@ -733,7 +617,8 @@ WITH cte_1 AS (SELECT * FROM test_table),
|
|
|
|
cte_2 AS (SELECT * FROM test_table ORDER BY 1 DESC LIMIT 3)
|
|
|
|
cte_2 AS (SELECT * FROM test_table ORDER BY 1 DESC LIMIT 3)
|
|
|
|
(SELECT *, (SELECT 1) FROM cte_1 EXCEPT SELECT *, 1 FROM test_table)
|
|
|
|
(SELECT *, (SELECT 1) FROM cte_1 EXCEPT SELECT *, 1 FROM test_table)
|
|
|
|
UNION
|
|
|
|
UNION
|
|
|
|
(SELECT *, 1 FROM cte_2);
|
|
|
|
(SELECT *, 1 FROM cte_2)
|
|
|
|
|
|
|
|
ORDER BY 1,2;
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_2 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_2 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
@ -751,13 +636,13 @@ DEBUG: Creating router plan
|
|
|
|
DEBUG: generating subplan XXX_3 for subquery SELECT key, value, other_value, (SELECT 1) FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_1
|
|
|
|
DEBUG: generating subplan XXX_3 for subquery SELECT key, value, other_value, (SELECT 1) FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_1
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: generating subplan XXX_4 for subquery SELECT key, value, other_value, 1 FROM cte_inline.test_table
|
|
|
|
DEBUG: generating subplan XXX_4 for subquery SELECT key, value, other_value, 1 FROM cte_inline.test_table
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value, intermediate_result."?column?" FROM read_intermediate_result('XXX_3'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb, "?column?" integer) EXCEPT SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value, intermediate_result."?column?" FROM read_intermediate_result('XXX_4'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb, "?column?" integer)) UNION SELECT cte_2.key, cte_2.value, cte_2.other_value, 1 FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_2
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value, intermediate_result."?column?" FROM read_intermediate_result('XXX_3'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb, "?column?" integer) EXCEPT SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value, intermediate_result."?column?" FROM read_intermediate_result('XXX_4'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb, "?column?" integer)) UNION SELECT cte_2.key, cte_2.value, cte_2.other_value, 1 FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_2'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_2 ORDER BY 1, 2
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
9 | test19 | {"f1": 19, "f2": 342, "f3": "test19"} | 1
|
|
|
|
9 | test29 | {"f1": 29, "f2": 522, "f3": "test29"} | 1
|
|
|
|
9 | test29 | {"f1": 29, "f2": 522, "f3": "test29"} | 1
|
|
|
|
9 | test9 | {"f1": 9, "f2": 162, "f3": "test9"} | 1
|
|
|
|
9 | test9 | {"f1": 9, "f2": 162, "f3": "test9"} | 1
|
|
|
|
9 | test19 | {"f1": 19, "f2": 342, "f3": "test19"} | 1
|
|
|
|
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
-- cte_1 is safe to inline, even if because after inlining
|
|
|
|
-- cte_1 is safe to inline, even if because after inlining
|
|
|
@ -811,11 +696,17 @@ FROM
|
|
|
|
cte LEFT JOIN test_table USING (key);
|
|
|
|
cte LEFT JOIN test_table USING (key);
|
|
|
|
DEBUG: CTE cte is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
count
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key, value, other_value FROM cte_inline.test_table
|
|
|
|
1021
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte LEFT JOIN cte_inline.test_table USING (key))
|
|
|
|
(1 row)
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE cte: SELECT key, value, other_value FROM cte_inline.test_table
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte LEFT JOIN cte_inline.test_table USING (key))
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
ERROR: cannot pushdown the subquery
|
|
|
|
|
|
|
|
DETAIL: Complex subqueries and CTEs cannot be in the outer part of the outer join
|
|
|
|
-- the CTEs are very simple, so postgres
|
|
|
|
-- the CTEs are very simple, so postgres
|
|
|
|
-- can pull-up the subqueries after inlining
|
|
|
|
-- can pull-up the subqueries after inlining
|
|
|
|
-- the CTEs, and the query that we send to workers
|
|
|
|
-- the CTEs, and the query that we send to workers
|
|
|
@ -829,18 +720,10 @@ FROM
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_2 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_2 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [-1073741824,-1]
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [0,1073741823]
|
|
|
|
DEBUG: generating subplan XXX_1 for subquery SELECT key FROM cte_inline.test_table
|
|
|
|
DEBUG: join prunable for intervals [-2147483648,-1073741825] and [1073741824,2147483647]
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM ((SELECT test_table.key FROM cte_inline.test_table) cte_1 JOIN (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) cte_2 USING (key))
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [-2147483648,-1073741825]
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [0,1073741823]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [-1073741824,-1] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [0,1073741823] and [1073741824,2147483647]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-2147483648,-1073741825]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [-1073741824,-1]
|
|
|
|
|
|
|
|
DEBUG: join prunable for intervals [1073741824,2147483647] and [0,1073741823]
|
|
|
|
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
1021
|
|
|
|
1021
|
|
|
@ -896,12 +779,7 @@ DEBUG: Creating router plan
|
|
|
|
-- we de still don't support it
|
|
|
|
-- we de still don't support it
|
|
|
|
WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
|
|
|
WITH cte_1 AS NOT MATERIALIZED (SELECT * FROM test_table)
|
|
|
|
DELETE FROM test_table WHERE key NOT IN (SELECT key FROM cte_1);
|
|
|
|
DELETE FROM test_table WHERE key NOT IN (SELECT key FROM cte_1);
|
|
|
|
DEBUG: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE cte_1: SELECT key, value, other_value FROM cte_inline.test_table
|
|
|
|
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: DELETE FROM cte_inline.test_table WHERE (NOT (key OPERATOR(pg_catalog.=) ANY (SELECT cte_1.key FROM (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_1)))
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
-- we don't inline CTEs if they are modifying CTEs
|
|
|
|
-- we don't inline CTEs if they are modifying CTEs
|
|
|
|
WITH cte_1 AS (DELETE FROM test_table WHERE key % 3 = 1 RETURNING key)
|
|
|
|
WITH cte_1 AS (DELETE FROM test_table WHERE key % 3 = 1 RETURNING key)
|
|
|
|
SELECT * FROM cte_1 ORDER BY 1 DESC LIMIT 3;
|
|
|
|
SELECT * FROM cte_1 ORDER BY 1 DESC LIMIT 3;
|
|
|
@ -920,18 +798,7 @@ DEBUG: Creating router plan
|
|
|
|
-- NOT MATERIALIZED should not affect modifying CTEs
|
|
|
|
-- NOT MATERIALIZED should not affect modifying CTEs
|
|
|
|
WITH cte_1 AS NOT MATERIALIZED (DELETE FROM test_table WHERE key % 3 = 0 RETURNING key)
|
|
|
|
WITH cte_1 AS NOT MATERIALIZED (DELETE FROM test_table WHERE key % 3 = 0 RETURNING key)
|
|
|
|
SELECT count(*) FROM cte_1;
|
|
|
|
SELECT count(*) FROM cte_1;
|
|
|
|
DEBUG: data-modifying statements are not supported in the WITH clauses of distributed queries
|
|
|
|
ERROR: syntax error at or near "NOT"
|
|
|
|
DEBUG: generating subplan XXX_1 for CTE cte_1: DELETE FROM cte_inline.test_table WHERE ((key OPERATOR(pg_catalog.%) 3) OPERATOR(pg_catalog.=) 0) RETURNING key
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer)) cte_1
|
|
|
|
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
|
|
|
|
DEBUG: Plan is router executable
|
|
|
|
|
|
|
|
count
|
|
|
|
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- cte with column aliases
|
|
|
|
-- cte with column aliases
|
|
|
|
SELECT * FROM test_table,
|
|
|
|
SELECT * FROM test_table,
|
|
|
|
(WITH cte_1 (x,y) AS (SELECT * FROM test_table),
|
|
|
|
(WITH cte_1 (x,y) AS (SELECT * FROM test_table),
|
|
|
@ -947,13 +814,13 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT test_table.key, test_table.value, test_table.other_value, bar.z, bar.y, bar.key, bar.t, bar.m, bar.cte_2_key FROM cte_inline.test_table, (SELECT cte_2.z, cte_2.y, cte_2.key, cte_3.t, cte_3.m, cte_3.cte_2_key FROM (SELECT intermediate_result.value AS z, intermediate_result.other_value AS y, intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text, other_value jsonb, key integer)) cte_2, (SELECT cte_2_1.z AS t, cte_2_1.y AS m, cte_2_1.key AS cte_2_key FROM (SELECT intermediate_result.value AS z, intermediate_result.other_value AS y, intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text, other_value jsonb, key integer)) cte_2_1) cte_3) bar ORDER BY test_table.value, test_table.other_value, bar.z, bar.y, bar.t, bar.m, bar.cte_2_key LIMIT 5
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT test_table.key, test_table.value, test_table.other_value, bar.z, bar.y, bar.key, bar.t, bar.m, bar.cte_2_key FROM cte_inline.test_table, (SELECT cte_2.z, cte_2.y, cte_2.key, cte_3.t, cte_3.m, cte_3.cte_2_key FROM (SELECT intermediate_result.value AS z, intermediate_result.other_value AS y, intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text, other_value jsonb, key integer)) cte_2, (SELECT cte_2_1.z AS t, cte_2_1.y AS m, cte_2_1.key AS cte_2_key FROM (SELECT intermediate_result.value AS z, intermediate_result.other_value AS y, intermediate_result.key FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(value text, other_value jsonb, key integer)) cte_2_1) cte_3) bar ORDER BY test_table.value, test_table.other_value, bar.z, bar.y, bar.t, bar.m, bar.cte_2_key LIMIT 5
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: push down of limit count: 5
|
|
|
|
DEBUG: push down of limit count: 5
|
|
|
|
key | value | other_value | z | y | key | t | m | cte_2_key
|
|
|
|
key | value | other_value | z | y | key | t | m | cte_2_key
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
2 | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | 2 | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | 2
|
|
|
|
0 | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | 0 | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | 0
|
|
|
|
2 | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | 2 | test12 | | 2
|
|
|
|
0 | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | 0 | test0 | | 0
|
|
|
|
2 | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | 2 | test12 | | 2
|
|
|
|
0 | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | 0 | test0 | | 0
|
|
|
|
2 | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | 2 | test12 | | 2
|
|
|
|
0 | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | 0 | test0 | | 0
|
|
|
|
2 | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | test12 | {"f1": 12, "f2": 216, "f3": "test12"} | 2 | test15 | {"f1": 15, "f2": 270, "f3": "test15"} | 5
|
|
|
|
0 | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | test0 | {"f1": 0, "f2": 0, "f3": "test0"} | 0 | test10 | {"f1": 10, "f2": 180, "f3": "test10"} | 0
|
|
|
|
(5 rows)
|
|
|
|
(5 rows)
|
|
|
|
|
|
|
|
|
|
|
|
-- cte used in HAVING subquery just works fine
|
|
|
|
-- cte used in HAVING subquery just works fine
|
|
|
@ -977,10 +844,12 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, count(*)
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
key | count
|
|
|
|
key | count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
0 | 44
|
|
|
|
|
|
|
|
9 | 40
|
|
|
|
8 | 40
|
|
|
|
8 | 40
|
|
|
|
|
|
|
|
6 | 40
|
|
|
|
5 | 40
|
|
|
|
5 | 40
|
|
|
|
2 | 40
|
|
|
|
(5 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- cte used in ORDER BY just works fine
|
|
|
|
-- cte used in ORDER BY just works fine
|
|
|
|
-- even if it is inlined
|
|
|
|
-- even if it is inlined
|
|
|
@ -1001,9 +870,9 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
key
|
|
|
|
key
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8
|
|
|
|
9
|
|
|
|
8
|
|
|
|
9
|
|
|
|
8
|
|
|
|
9
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
PREPARE inlined_cte_without_params AS
|
|
|
|
PREPARE inlined_cte_without_params AS
|
|
|
@ -1036,7 +905,7 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
44
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
@ -1044,7 +913,7 @@ DEBUG: push down of limit count: 3
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
44
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
@ -1052,7 +921,7 @@ EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
44
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
@ -1060,7 +929,7 @@ EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
44
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
@ -1068,7 +937,7 @@ EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
44
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
@ -1076,7 +945,7 @@ EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
EXECUTE inlined_cte_without_params;
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
44
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
@ -1091,49 +960,49 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
EXECUTE non_inlined_cte_without_params;
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_non_dist_key('test1');
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_non_dist_key('test1');
|
|
|
@ -1159,7 +1028,8 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
(0 rows)
|
|
|
|
4
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_non_dist_key('test4');
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_non_dist_key('test4');
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1186,7 +1056,8 @@ DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
(0 rows)
|
|
|
|
4
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(1);
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(1);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1207,7 +1078,8 @@ DEBUG: push down of limit count: 3
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(2 rows)
|
|
|
|
40
|
|
|
|
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(3);
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(3);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1217,7 +1089,8 @@ DEBUG: push down of limit count: 3
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(2 rows)
|
|
|
|
40
|
|
|
|
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(4);
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(4);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1227,7 +1100,8 @@ DEBUG: push down of limit count: 3
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(2 rows)
|
|
|
|
40
|
|
|
|
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(5);
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(5);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1236,7 +1110,9 @@ DEBUG: push down of limit count: 3
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(1 row)
|
|
|
|
40
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(6);
|
|
|
|
EXECUTE inlined_cte_has_parameter_on_dist_key(6);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1247,7 +1123,8 @@ DEBUG: push down of limit count: 3
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
40
|
|
|
|
40
|
|
|
|
(1 row)
|
|
|
|
40
|
|
|
|
|
|
|
|
(2 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(1);
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(1);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
@ -1259,9 +1136,9 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(2);
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(2);
|
|
|
@ -1274,9 +1151,9 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(3);
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(3);
|
|
|
@ -1289,9 +1166,9 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(4);
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(4);
|
|
|
@ -1304,9 +1181,9 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(5);
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(5);
|
|
|
@ -1319,9 +1196,9 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(6);
|
|
|
|
EXECUTE non_inlined_cte_has_parameter_on_dist_key(6);
|
|
|
@ -1336,49 +1213,49 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT key, value, o
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
key | value | other_value | ?column?
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
8 | test98 | | 1
|
|
|
|
9 | test99 | | 1
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE retry_planning(1);
|
|
|
|
EXECUTE retry_planning(1);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "2" : "test12", "2" : "test2", "2" : "test22", "2" : "test32", "2" : "test42", "2" : "test52", "2" : "test62", "2" : "test72", "2" : "test82", "2" : "test92", "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "2" : "test12", "2" : "test2", "2" : "test22", "2" : "test32", "2" : "test42", "2" : "test52", "2" : "test62", "2" : "test72", "2" : "test82", "2" : "test92", "3" : "test13", "3" : "test23", "3" : "test3", "3" : "test33", "3" : "test43", "3" : "test53", "3" : "test63", "3" : "test73", "3" : "test83", "3" : "test93", "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "6" : "test16", "6" : "test26", "6" : "test36", "6" : "test46", "6" : "test56", "6" : "test6", "6" : "test66", "6" : "test76", "6" : "test86", "6" : "test96", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE retry_planning(2);
|
|
|
|
EXECUTE retry_planning(2);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "3" : "test13", "3" : "test23", "3" : "test3", "3" : "test33", "3" : "test43", "3" : "test53", "3" : "test63", "3" : "test73", "3" : "test83", "3" : "test93", "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "6" : "test16", "6" : "test26", "6" : "test36", "6" : "test46", "6" : "test56", "6" : "test6", "6" : "test66", "6" : "test76", "6" : "test86", "6" : "test96", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE retry_planning(3);
|
|
|
|
EXECUTE retry_planning(3);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "6" : "test16", "6" : "test26", "6" : "test36", "6" : "test46", "6" : "test56", "6" : "test6", "6" : "test66", "6" : "test76", "6" : "test86", "6" : "test96", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE retry_planning(4);
|
|
|
|
EXECUTE retry_planning(4);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "6" : "test16", "6" : "test26", "6" : "test36", "6" : "test46", "6" : "test56", "6" : "test6", "6" : "test66", "6" : "test76", "6" : "test86", "6" : "test96", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE retry_planning(5);
|
|
|
|
EXECUTE retry_planning(5);
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "6" : "test16", "6" : "test26", "6" : "test36", "6" : "test46", "6" : "test56", "6" : "test6", "6" : "test66", "6" : "test76", "6" : "test86", "6" : "test96", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
EXECUTE retry_planning(6);
|
|
|
|
EXECUTE retry_planning(6);
|
|
|
@ -1386,9 +1263,9 @@ DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
-- this test can only work if the CTE is recursively
|
|
|
|
-- this test can only work if the CTE is recursively
|
|
|
@ -1410,7 +1287,7 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS c
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
4800
|
|
|
|
11536
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
-- this becomes a non-colocated subquery join
|
|
|
|
-- this becomes a non-colocated subquery join
|
|
|
@ -1428,7 +1305,7 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT count(*) AS c
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
count
|
|
|
|
count
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
480
|
|
|
|
1136
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
-- cte a has to be recursively planned because of OFFSET 0
|
|
|
|
-- cte a has to be recursively planned because of OFFSET 0
|
|
|
@ -1452,7 +1329,7 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT min(a.key) AS
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
min
|
|
|
|
min
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
2
|
|
|
|
0
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
-- after both CTEs are inlined, this becomes non-colocated subquery join
|
|
|
|
-- after both CTEs are inlined, this becomes non-colocated subquery join
|
|
|
@ -1467,11 +1344,11 @@ DEBUG: generating subplan XXX_1 for subquery SELECT key, value, other_value FRO
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT cte_1.key, cte_1.value, cte_1.other_value, cte_2.key, cte_2.value, cte_2.other_value FROM ((SELECT test_table.key, test_table.value, test_table.other_value FROM cte_inline.test_table) cte_1 JOIN (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_2 ON ((cte_1.value OPERATOR(pg_catalog.>) cte_2.value))) ORDER BY cte_1.key, cte_1.value, cte_1.other_value, cte_2.key, cte_2.value, cte_2.other_value DESC LIMIT 3
|
|
|
|
DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT cte_1.key, cte_1.value, cte_1.other_value, cte_2.key, cte_2.value, cte_2.other_value FROM ((SELECT test_table.key, test_table.value, test_table.other_value FROM cte_inline.test_table) cte_1 JOIN (SELECT intermediate_result.key, intermediate_result.value, intermediate_result.other_value FROM read_intermediate_result('XXX_1'::text, 'binary'::citus_copy_format) intermediate_result(key integer, value text, other_value jsonb)) cte_2 ON ((cte_1.value OPERATOR(pg_catalog.>) cte_2.value))) ORDER BY cte_1.key, cte_1.value, cte_1.other_value, cte_2.key, cte_2.value, cte_2.other_value DESC LIMIT 3
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
DEBUG: push down of limit count: 3
|
|
|
|
key | value | other_value | key | value | other_value
|
|
|
|
key | value | other_value | key | value | other_value
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
2 | test2 | {"f1": 2, "f2": 36, "f3": "test2"} | 2 | test12 |
|
|
|
|
0 | test10 | {"f1": 10, "f2": 180, "f3": "test10"} | 0 | test0 |
|
|
|
|
2 | test2 | {"f1": 2, "f2": 36, "f3": "test2"} | 2 | test12 |
|
|
|
|
0 | test10 | {"f1": 10, "f2": 180, "f3": "test10"} | 0 | test0 |
|
|
|
|
2 | test2 | {"f1": 2, "f2": 36, "f3": "test2"} | 2 | test12 |
|
|
|
|
0 | test10 | {"f1": 10, "f2": 180, "f3": "test10"} | 0 | test0 |
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
-- full join is only supported when both sides are
|
|
|
|
-- full join is only supported when both sides are
|
|
|
@ -1495,9 +1372,9 @@ DEBUG: Plan XXX query after replacing subqueries and CTEs: SELECT value FROM ((
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
DEBUG: Creating router plan
|
|
|
|
value
|
|
|
|
value
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
test98
|
|
|
|
test99
|
|
|
|
test98
|
|
|
|
test99
|
|
|
|
test98
|
|
|
|
test99
|
|
|
|
(3 rows)
|
|
|
|
(3 rows)
|
|
|
|
|
|
|
|
|
|
|
|
-- an unsupported agg. for multi-shard queries
|
|
|
|
-- an unsupported agg. for multi-shard queries
|
|
|
@ -1506,9 +1383,9 @@ WITH cte_1 AS (SELECT * FROM test_table WHERE key > 1)
|
|
|
|
SELECT json_object_agg(DISTINCT key, value) FROM cte_1;
|
|
|
|
SELECT json_object_agg(DISTINCT key, value) FROM cte_1;
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: CTE cte_1 is going to be inlined via distributed planning
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
|
|
json_object_agg
|
|
|
|
json_object_agg
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
{ "2" : "test12", "2" : "test2", "2" : "test22", "2" : "test32", "2" : "test42", "2" : "test52", "2" : "test62", "2" : "test72", "2" : "test82", "2" : "test92", "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98" }
|
|
|
|
{ "2" : "test12", "2" : "test2", "2" : "test22", "2" : "test32", "2" : "test42", "2" : "test52", "2" : "test62", "2" : "test72", "2" : "test82", "2" : "test92", "3" : "test13", "3" : "test23", "3" : "test3", "3" : "test33", "3" : "test43", "3" : "test53", "3" : "test63", "3" : "test73", "3" : "test83", "3" : "test93", "5" : "test15", "5" : "test25", "5" : "test35", "5" : "test45", "5" : "test5", "5" : "test55", "5" : "test65", "5" : "test75", "5" : "test85", "5" : "test95", "6" : "test16", "6" : "test26", "6" : "test36", "6" : "test46", "6" : "test56", "6" : "test6", "6" : "test66", "6" : "test76", "6" : "test86", "6" : "test96", "8" : "test18", "8" : "test28", "8" : "test38", "8" : "test48", "8" : "test58", "8" : "test68", "8" : "test78", "8" : "test8", "8" : "test88", "8" : "test98", "9" : "test19", "9" : "test29", "9" : "test39", "9" : "test49", "9" : "test59", "9" : "test69", "9" : "test79", "9" : "test89", "9" : "test9", "9" : "test99" }
|
|
|
|
(1 row)
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
|
|
|
|
-- both cte_1 and cte_2 are going to be inlined.
|
|
|
|
-- both cte_1 and cte_2 are going to be inlined.
|
|
|
|