mirror of https://github.com/citusdata/citus.git
385 lines
25 KiB
Plaintext
385 lines
25 KiB
Plaintext
CREATE SCHEMA recursive_set_local;
|
|
SET search_path TO recursive_set_local, public;
|
|
CREATE TABLE recursive_set_local.test (x int, y int);
|
|
SELECT create_distributed_table('test', 'x');
|
|
create_distributed_table
|
|
--------------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE recursive_set_local.ref (a int, b int);
|
|
SELECT create_reference_table('ref');
|
|
create_reference_table
|
|
------------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE recursive_set_local.local_test (x int, y int);
|
|
INSERT INTO test VALUES (1,1), (2,2);
|
|
INSERT INTO ref VALUES (2,2), (3,3);
|
|
INSERT INTO local_test VALUES (3,3), (4,4);
|
|
SET client_min_messages TO DEBUG;
|
|
-- we should be able to run set operations with local tables
|
|
(SELECT x FROM test) INTERSECT (SELECT x FROM local_test) ORDER BY 1 DESC;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 3_1 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 3_2 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Plan 3 query after replacing subqueries and CTEs: SELECT intermediate_result.x FROM read_intermediate_result('3_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer) INTERSECT SELECT intermediate_result.x FROM read_intermediate_result('3_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
(0 rows)
|
|
|
|
-- we should be able to run set operations with generate series
|
|
(SELECT x FROM test) INTERSECT (SELECT i FROM generate_series(0, 100) i) ORDER BY 1 DESC;
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 5_1 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Plan 5 query after replacing subqueries and CTEs: SELECT intermediate_result.x FROM read_intermediate_result('5_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) INTERSECT SELECT i.i FROM generate_series(0, 100) i(i) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
2
|
|
1
|
|
(2 rows)
|
|
|
|
-- we'd first recursively plan the query with "test", thus don't need to recursively
|
|
-- plan other query
|
|
(SELECT x FROM test LIMIT 5) INTERSECT (SELECT i FROM generate_series(0, 100) i) ORDER BY 1 DESC;
|
|
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: generating subplan 7_1 for subquery SELECT x FROM recursive_set_local.test LIMIT 5
|
|
DEBUG: Plan 7 query after replacing subqueries and CTEs: SELECT intermediate_result.x FROM read_intermediate_result('7_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) INTERSECT SELECT i.i FROM generate_series(0, 100) i(i) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
2
|
|
1
|
|
(2 rows)
|
|
|
|
-- this doesn't require any recursive planning
|
|
(SELECT a FROM ref) INTERSECT (SELECT i FROM generate_series(0, 100) i) ORDER BY 1 DESC;
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
a
|
|
---
|
|
3
|
|
2
|
|
(2 rows)
|
|
|
|
-- same query with a failure on the worker (i.e., division by zero)
|
|
(SELECT x FROM test) INTERSECT (SELECT i/0 FROM generate_series(0, 100) i) ORDER BY 1 DESC;
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 10_1 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Plan 10 query after replacing subqueries and CTEs: SELECT intermediate_result.x FROM read_intermediate_result('10_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) INTERSECT SELECT (i.i OPERATOR(pg_catalog./) 0) FROM generate_series(0, 100) i(i) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
ERROR: division by zero
|
|
CONTEXT: while executing command on localhost:57637
|
|
-- we should be able to run set operations with generate series and local tables as well
|
|
((SELECT x FROM local_test) UNION ALL (SELECT x FROM test)) INTERSECT (SELECT i FROM generate_series(0, 100) i) ORDER BY 1 DESC;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 12_1 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 12_2 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Plan 12 query after replacing subqueries and CTEs: (SELECT intermediate_result.x FROM read_intermediate_result('12_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) UNION ALL SELECT intermediate_result.x FROM read_intermediate_result('12_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) INTERSECT SELECT i.i FROM generate_series(0, 100) i(i) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
4
|
|
3
|
|
2
|
|
1
|
|
(4 rows)
|
|
|
|
-- two local tables are on different leaf queries, so safe to plan & execute
|
|
((SELECT x FROM local_test) UNION ALL (SELECT x FROM test)) INTERSECT (SELECT x FROM local_test) ORDER BY 1 DESC;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 14_1 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: generating subplan 14_2 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 14_3 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Plan 14 query after replacing subqueries and CTEs: (SELECT intermediate_result.x FROM read_intermediate_result('14_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) UNION ALL SELECT intermediate_result.x FROM read_intermediate_result('14_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) INTERSECT SELECT intermediate_result.x FROM read_intermediate_result('14_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
4
|
|
3
|
|
(2 rows)
|
|
|
|
-- use ctes inside unions along with local tables on the top level
|
|
WITH
|
|
cte_1 AS (SELECT user_id FROM users_table),
|
|
cte_2 AS (SELECT user_id FROM events_table)
|
|
((SELECT * FROM cte_1) UNION (SELECT * FROM cte_2) UNION (SELECT x FROM local_test)) INTERSECT (SELECT i FROM generate_series(0, 100) i)
|
|
ORDER BY 1 DESC;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 16_1 for CTE cte_1: SELECT user_id FROM public.users_table
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 16_2 for CTE cte_2: SELECT user_id FROM public.events_table
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 16_3 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Plan 16 query after replacing subqueries and CTEs: (SELECT cte_1.user_id FROM (SELECT intermediate_result.user_id FROM read_intermediate_result('16_1'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) cte_1 UNION SELECT cte_2.user_id FROM (SELECT intermediate_result.user_id FROM read_intermediate_result('16_2'::text, 'binary'::citus_copy_format) intermediate_result(user_id integer)) cte_2 UNION SELECT intermediate_result.x FROM read_intermediate_result('16_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) INTERSECT SELECT i.i FROM generate_series(0, 100) i(i) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
user_id
|
|
---------
|
|
6
|
|
5
|
|
4
|
|
3
|
|
2
|
|
1
|
|
(6 rows)
|
|
|
|
-- CTEs inside subqueries unioned with local table
|
|
-- final query is real-time
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
(
|
|
((WITH cte_1 AS (SELECT x FROM test) SELECT * FROM cte_1) UNION
|
|
(WITH cte_1 AS (SELECT a FROM ref) SELECT * FROM cte_1)) INTERSECT
|
|
(SELECT x FROM local_test)
|
|
) as foo,
|
|
test
|
|
WHERE test.y = foo.x;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 19_1 for CTE cte_1: SELECT x FROM recursive_set_local.test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 19_2 for CTE cte_1: SELECT a FROM recursive_set_local.ref
|
|
DEBUG: Distributed planning for a fast-path router query
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 19_3 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 19_4 for subquery (SELECT cte_1.x FROM (SELECT intermediate_result.x FROM read_intermediate_result('19_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) cte_1 UNION SELECT cte_1.a FROM (SELECT intermediate_result.a FROM read_intermediate_result('19_2'::text, 'binary'::citus_copy_format) intermediate_result(a integer)) cte_1) INTERSECT SELECT intermediate_result.x FROM read_intermediate_result('19_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer)
|
|
DEBUG: Plan 19 query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.x FROM read_intermediate_result('19_4'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) foo, recursive_set_local.test WHERE (test.y OPERATOR(pg_catalog.=) foo.x)
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
count
|
|
-------
|
|
0
|
|
(1 row)
|
|
|
|
-- CTEs inside subqueries unioned with local table
|
|
-- final query is router
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
(
|
|
((WITH cte_1 AS (SELECT x FROM test) SELECT * FROM cte_1) UNION
|
|
(WITH cte_1 AS (SELECT a FROM ref) SELECT * FROM cte_1)) INTERSECT
|
|
(SELECT x FROM local_test)
|
|
) as foo,
|
|
ref
|
|
WHERE ref.a = foo.x;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 23_1 for CTE cte_1: SELECT x FROM recursive_set_local.test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 23_2 for CTE cte_1: SELECT a FROM recursive_set_local.ref
|
|
DEBUG: Distributed planning for a fast-path router query
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 23_3 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 23_4 for subquery (SELECT cte_1.x FROM (SELECT intermediate_result.x FROM read_intermediate_result('23_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) cte_1 UNION SELECT cte_1.a FROM (SELECT intermediate_result.a FROM read_intermediate_result('23_2'::text, 'binary'::citus_copy_format) intermediate_result(a integer)) cte_1) INTERSECT SELECT intermediate_result.x FROM read_intermediate_result('23_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer)
|
|
DEBUG: Plan 23 query after replacing subqueries and CTEs: SELECT count(*) AS count FROM (SELECT intermediate_result.x FROM read_intermediate_result('23_4'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) foo, recursive_set_local.ref WHERE (ref.a OPERATOR(pg_catalog.=) foo.x)
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
count
|
|
-------
|
|
1
|
|
(1 row)
|
|
|
|
-- subquery union in WHERE clause without parition column equality is recursively planned including the local tables
|
|
SELECT * FROM test a WHERE x IN (SELECT x FROM test b UNION SELECT y FROM test c UNION SELECT y FROM local_test d) ORDER BY 1,2;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 27_1 for subquery SELECT y FROM recursive_set_local.local_test d
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 27_2 for subquery SELECT x FROM recursive_set_local.test b
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 27_3 for subquery SELECT y FROM recursive_set_local.test c
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 27_4 for subquery SELECT intermediate_result.x FROM read_intermediate_result('27_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer) UNION SELECT intermediate_result.y FROM read_intermediate_result('27_3'::text, 'binary'::citus_copy_format) intermediate_result(y integer) UNION SELECT intermediate_result.y FROM read_intermediate_result('27_1'::text, 'binary'::citus_copy_format) intermediate_result(y integer)
|
|
DEBUG: Plan 27 query after replacing subqueries and CTEs: SELECT x, y FROM recursive_set_local.test a WHERE (x OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.x FROM read_intermediate_result('27_4'::text, 'binary'::citus_copy_format) intermediate_result(x integer))) ORDER BY x, y
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
x | y
|
|
---+---
|
|
1 | 1
|
|
2 | 2
|
|
(2 rows)
|
|
|
|
-- same query with subquery in where is wrapped in CTE
|
|
SELECT * FROM test a WHERE x IN (WITH cte AS (SELECT x FROM test b UNION SELECT y FROM test c UNION SELECT y FROM local_test d) SELECT * FROM cte) ORDER BY 1,2;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 31_1 for CTE cte: SELECT b.x FROM recursive_set_local.test b UNION SELECT c.y FROM recursive_set_local.test c UNION SELECT d.y FROM recursive_set_local.local_test d
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 32_1 for subquery SELECT y FROM recursive_set_local.local_test d
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 32_2 for subquery SELECT x FROM recursive_set_local.test b
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 32_3 for subquery SELECT y FROM recursive_set_local.test c
|
|
DEBUG: Plan 32 query after replacing subqueries and CTEs: SELECT intermediate_result.x FROM read_intermediate_result('32_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer) UNION SELECT intermediate_result.y FROM read_intermediate_result('32_3'::text, 'binary'::citus_copy_format) intermediate_result(y integer) UNION SELECT intermediate_result.y FROM read_intermediate_result('32_1'::text, 'binary'::citus_copy_format) intermediate_result(y integer)
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: Plan 31 query after replacing subqueries and CTEs: SELECT x, y FROM recursive_set_local.test a WHERE (x OPERATOR(pg_catalog.=) ANY (SELECT cte.x FROM (SELECT intermediate_result.x FROM read_intermediate_result('31_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) cte)) ORDER BY x, y
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
x | y
|
|
---+---
|
|
1 | 1
|
|
2 | 2
|
|
(2 rows)
|
|
|
|
-- not supported since local table is joined with a set operation
|
|
SELECT * FROM ((SELECT * FROM test) EXCEPT (SELECT * FROM test ORDER BY x LIMIT 1)) u JOIN local_test USING (x) ORDER BY 1,2;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: push down of limit count: 1
|
|
DEBUG: generating subplan 35_1 for subquery SELECT x, y FROM recursive_set_local.test ORDER BY x LIMIT 1
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 35_2 for subquery SELECT x, y FROM recursive_set_local.test
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 35_3 for subquery SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('35_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer) EXCEPT SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('35_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)
|
|
DEBUG: Plan 35 query after replacing subqueries and CTEs: SELECT u.x, u.y, local_test.y FROM ((SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('35_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)) u JOIN recursive_set_local.local_test USING (x)) ORDER BY u.x, u.y
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
ERROR: relation local_test is not distributed
|
|
-- though we replace some queries including the local query, the intermediate result is on the outer part of an outer join
|
|
SELECT * FROM ((SELECT * FROM local_test) INTERSECT (SELECT * FROM test ORDER BY x LIMIT 1)) u LEFT JOIN test USING (x) ORDER BY 1,2;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 39_1 for subquery SELECT x, y FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: push down of limit count: 1
|
|
DEBUG: generating subplan 39_2 for subquery SELECT x, y FROM recursive_set_local.test ORDER BY x LIMIT 1
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 39_3 for subquery SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('39_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer) INTERSECT SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('39_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)
|
|
DEBUG: Plan 39 query after replacing subqueries and CTEs: SELECT u.x, u.y, test.y FROM ((SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('39_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)) u LEFT JOIN recursive_set_local.test USING (x)) ORDER BY u.x, u.y
|
|
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
|
|
-- we replace some queries including the local query, the intermediate result is on the inner part of an outer join
|
|
SELECT * FROM ((SELECT * FROM local_test) INTERSECT (SELECT * FROM test ORDER BY x LIMIT 1)) u RIGHT JOIN test USING (x) ORDER BY 1,2;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 42_1 for subquery SELECT x, y FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: push down of limit count: 1
|
|
DEBUG: generating subplan 42_2 for subquery SELECT x, y FROM recursive_set_local.test ORDER BY x LIMIT 1
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 42_3 for subquery SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('42_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer) INTERSECT SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('42_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)
|
|
DEBUG: Plan 42 query after replacing subqueries and CTEs: SELECT test.x, u.y, test.y FROM ((SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('42_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)) u RIGHT JOIN recursive_set_local.test USING (x)) ORDER BY test.x, u.y
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
x | y | y
|
|
---+---+---
|
|
1 | | 1
|
|
2 | | 2
|
|
(2 rows)
|
|
|
|
-- recurively plan left part of the join, and run a final real-time query
|
|
SELECT * FROM ((SELECT * FROM local_test) INTERSECT (SELECT * FROM test ORDER BY x LIMIT 1)) u INNER JOIN test USING (x) ORDER BY 1,2;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 45_1 for subquery SELECT x, y FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: push down of limit count: 1
|
|
DEBUG: generating subplan 45_2 for subquery SELECT x, y FROM recursive_set_local.test ORDER BY x LIMIT 1
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 45_3 for subquery SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('45_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer) INTERSECT SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('45_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)
|
|
DEBUG: Plan 45 query after replacing subqueries and CTEs: SELECT u.x, u.y, test.y FROM ((SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('45_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)) u JOIN recursive_set_local.test USING (x)) ORDER BY u.x, u.y
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
x | y | y
|
|
---+---+---
|
|
(0 rows)
|
|
|
|
-- set operations and the sublink can be recursively planned
|
|
SELECT * FROM ((SELECT x FROM test) UNION (SELECT x FROM (SELECT x FROM local_test) as foo WHERE x IN (SELECT x FROM test))) u ORDER BY 1;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: generating subplan 48_1 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 48_2 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 48_3 for subquery SELECT x FROM (SELECT intermediate_result.x FROM read_intermediate_result('48_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) foo WHERE (x OPERATOR(pg_catalog.=) ANY (SELECT intermediate_result.x FROM read_intermediate_result('48_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer)))
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 48_4 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
DEBUG: generating subplan 48_5 for subquery SELECT intermediate_result.x FROM read_intermediate_result('48_4'::text, 'binary'::citus_copy_format) intermediate_result(x integer) UNION SELECT intermediate_result.x FROM read_intermediate_result('48_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer)
|
|
DEBUG: Plan 48 query after replacing subqueries and CTEs: SELECT x FROM (SELECT intermediate_result.x FROM read_intermediate_result('48_5'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) u ORDER BY x
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
1
|
|
2
|
|
(2 rows)
|
|
|
|
SET citus.task_executor_type TO 'task-tracker';
|
|
-- repartition is recursively planned before the set operation
|
|
(SELECT x FROM test) INTERSECT (SELECT t1.x FROM test as t1, test as t2 WHERE t1.x = t2.y LIMIT 2) INTERSECT (((SELECT x FROM local_test) UNION ALL (SELECT x FROM test)) INTERSECT (SELECT i FROM generate_series(0, 100) i)) ORDER BY 1 DESC;
|
|
DEBUG: Local tables cannot be used in distributed queries.
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: push down of limit count: 2
|
|
DEBUG: join prunable for task partitionId 0 and 1
|
|
DEBUG: join prunable for task partitionId 0 and 2
|
|
DEBUG: join prunable for task partitionId 0 and 3
|
|
DEBUG: join prunable for task partitionId 1 and 0
|
|
DEBUG: join prunable for task partitionId 1 and 2
|
|
DEBUG: join prunable for task partitionId 1 and 3
|
|
DEBUG: join prunable for task partitionId 2 and 0
|
|
DEBUG: join prunable for task partitionId 2 and 1
|
|
DEBUG: join prunable for task partitionId 2 and 3
|
|
DEBUG: join prunable for task partitionId 3 and 0
|
|
DEBUG: join prunable for task partitionId 3 and 1
|
|
DEBUG: join prunable for task partitionId 3 and 2
|
|
DEBUG: pruning merge fetch taskId 1
|
|
DETAIL: Creating dependency on merge taskId 5
|
|
DEBUG: pruning merge fetch taskId 2
|
|
DETAIL: Creating dependency on merge taskId 5
|
|
DEBUG: pruning merge fetch taskId 4
|
|
DETAIL: Creating dependency on merge taskId 10
|
|
DEBUG: pruning merge fetch taskId 5
|
|
DETAIL: Creating dependency on merge taskId 10
|
|
DEBUG: pruning merge fetch taskId 7
|
|
DETAIL: Creating dependency on merge taskId 15
|
|
DEBUG: pruning merge fetch taskId 8
|
|
DETAIL: Creating dependency on merge taskId 15
|
|
DEBUG: pruning merge fetch taskId 10
|
|
DETAIL: Creating dependency on merge taskId 20
|
|
DEBUG: pruning merge fetch taskId 11
|
|
DETAIL: Creating dependency on merge taskId 20
|
|
DEBUG: generating subplan 53_1 for subquery SELECT t1.x FROM recursive_set_local.test t1, recursive_set_local.test t2 WHERE (t1.x OPERATOR(pg_catalog.=) t2.y) LIMIT 2
|
|
DEBUG: generating subplan 53_2 for subquery SELECT x FROM recursive_set_local.local_test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 53_3 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Router planner cannot handle multi-shard select queries
|
|
DEBUG: generating subplan 53_4 for subquery SELECT x FROM recursive_set_local.test
|
|
DEBUG: Plan 53 query after replacing subqueries and CTEs: SELECT intermediate_result.x FROM read_intermediate_result('53_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer) INTERSECT SELECT intermediate_result.x FROM read_intermediate_result('53_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer) INTERSECT ((SELECT intermediate_result.x FROM read_intermediate_result('53_2'::text, 'binary'::citus_copy_format) intermediate_result(x integer) UNION ALL SELECT intermediate_result.x FROM read_intermediate_result('53_4'::text, 'binary'::citus_copy_format) intermediate_result(x integer)) INTERSECT SELECT i.i FROM generate_series(0, 100) i(i)) ORDER BY 1 DESC
|
|
DEBUG: Creating router plan
|
|
DEBUG: Plan is router executable
|
|
x
|
|
---
|
|
2
|
|
1
|
|
(2 rows)
|
|
|
|
SET citus.task_executor_type TO 'adaptive';
|
|
RESET client_min_messages;
|
|
DROP SCHEMA recursive_set_local CASCADE;
|
|
NOTICE: drop cascades to 3 other objects
|
|
DETAIL: drop cascades to table test
|
|
drop cascades to table ref
|
|
drop cascades to table local_test
|