mirror of https://github.com/citusdata/citus.git
commit
6362c40865
|
@ -612,7 +612,7 @@ WHERE
|
||||||
);
|
);
|
||||||
ERROR: cannot push down this subquery
|
ERROR: cannot push down this subquery
|
||||||
DETAIL: Offset clause is currently unsupported when a subquery references a column from another query
|
DETAIL: Offset clause is currently unsupported when a subquery references a column from another query
|
||||||
-- we can detect unsupported subquerues even if they appear
|
-- we can detect unsupported subqueries even if they appear
|
||||||
-- in WHERE subquery -> FROM subquery -> WHERE subquery
|
-- in WHERE subquery -> FROM subquery -> WHERE subquery
|
||||||
-- but we can recursively plan that anyway
|
-- but we can recursively plan that anyway
|
||||||
SELECT DISTINCT user_id
|
SELECT DISTINCT user_id
|
||||||
|
@ -636,15 +636,14 @@ WHERE user_id
|
||||||
users_table u1, events_table e1
|
users_table u1, events_table e1
|
||||||
WHERE
|
WHERE
|
||||||
e1.user_id = u1.user_id
|
e1.user_id = u1.user_id
|
||||||
AND e1.user_id IN (SELECT user_id FROM users_table LIMIT 3 )
|
AND e1.user_id IN (SELECT user_id FROM users_table ORDER BY user_id LIMIT 3)
|
||||||
) as f_outer
|
) as f_outer
|
||||||
WHERE f_inner.user_id = f_outer.user_id
|
WHERE f_inner.user_id = f_outer.user_id
|
||||||
) ORDER BY 1 LIMIT 3;
|
) ORDER BY 1 LIMIT 3;
|
||||||
user_id
|
user_id
|
||||||
---------
|
---------
|
||||||
1
|
1
|
||||||
5
|
(1 row)
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
-- semi join is not on the partition key for the third subquery, and recursively planned
|
-- semi join is not on the partition key for the third subquery, and recursively planned
|
||||||
SET client_min_messages TO DEBUG1;
|
SET client_min_messages TO DEBUG1;
|
||||||
|
|
|
@ -858,13 +858,13 @@ SELECT * FROM set_view_pushdown ORDER BY 1 DESC;
|
||||||
|
|
||||||
-- this should be recursively planned
|
-- this should be recursively planned
|
||||||
CREATE VIEW set_view_recursive_second AS SELECT u.x, test.y FROM ((SELECT x, y FROM test) UNION (SELECT 1, 1 FROM test)) u JOIN test USING (x) ORDER BY 1,2;
|
CREATE VIEW set_view_recursive_second AS SELECT u.x, test.y FROM ((SELECT x, y FROM test) UNION (SELECT 1, 1 FROM test)) u JOIN test USING (x) ORDER BY 1,2;
|
||||||
SELECT * FROM set_view_recursive_second;
|
SELECT * FROM set_view_recursive_second ORDER BY 1,2;
|
||||||
DEBUG: generating subplan 175_1 for subquery SELECT x, y FROM recursive_union.test
|
DEBUG: generating subplan 175_1 for subquery SELECT x, y FROM recursive_union.test
|
||||||
DEBUG: generating subplan 175_2 for subquery SELECT 1, 1 FROM recursive_union.test
|
DEBUG: generating subplan 175_2 for subquery SELECT 1, 1 FROM recursive_union.test
|
||||||
DEBUG: Creating router plan
|
DEBUG: Creating router plan
|
||||||
DEBUG: Plan is router executable
|
DEBUG: Plan is router executable
|
||||||
DEBUG: generating subplan 175_3 for subquery SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('175_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer) UNION SELECT intermediate_result."?column?", intermediate_result."?column?_1" AS "?column?" FROM read_intermediate_result('175_2'::text, 'binary'::citus_copy_format) intermediate_result("?column?" integer, "?column?_1" integer)
|
DEBUG: generating subplan 175_3 for subquery SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('175_1'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer) UNION SELECT intermediate_result."?column?", intermediate_result."?column?_1" AS "?column?" FROM read_intermediate_result('175_2'::text, 'binary'::citus_copy_format) intermediate_result("?column?" integer, "?column?_1" integer)
|
||||||
DEBUG: Plan 175 query after replacing subqueries and CTEs: SELECT x, y FROM (SELECT u.x, test.y FROM ((SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('175_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)) u JOIN recursive_union.test USING (x)) ORDER BY u.x, test.y) set_view_recursive_second
|
DEBUG: Plan 175 query after replacing subqueries and CTEs: SELECT x, y FROM (SELECT u.x, test.y FROM ((SELECT intermediate_result.x, intermediate_result.y FROM read_intermediate_result('175_3'::text, 'binary'::citus_copy_format) intermediate_result(x integer, y integer)) u JOIN recursive_union.test USING (x)) ORDER BY u.x, test.y) set_view_recursive_second ORDER BY x, y
|
||||||
x | y
|
x | y
|
||||||
---+---
|
---+---
|
||||||
1 | 1
|
1 | 1
|
||||||
|
|
|
@ -518,7 +518,7 @@ WHERE
|
||||||
OFFSET 3
|
OFFSET 3
|
||||||
);
|
);
|
||||||
|
|
||||||
-- we can detect unsupported subquerues even if they appear
|
-- we can detect unsupported subqueries even if they appear
|
||||||
-- in WHERE subquery -> FROM subquery -> WHERE subquery
|
-- in WHERE subquery -> FROM subquery -> WHERE subquery
|
||||||
-- but we can recursively plan that anyway
|
-- but we can recursively plan that anyway
|
||||||
SELECT DISTINCT user_id
|
SELECT DISTINCT user_id
|
||||||
|
@ -542,7 +542,7 @@ WHERE user_id
|
||||||
users_table u1, events_table e1
|
users_table u1, events_table e1
|
||||||
WHERE
|
WHERE
|
||||||
e1.user_id = u1.user_id
|
e1.user_id = u1.user_id
|
||||||
AND e1.user_id IN (SELECT user_id FROM users_table LIMIT 3 )
|
AND e1.user_id IN (SELECT user_id FROM users_table ORDER BY user_id LIMIT 3)
|
||||||
) as f_outer
|
) as f_outer
|
||||||
WHERE f_inner.user_id = f_outer.user_id
|
WHERE f_inner.user_id = f_outer.user_id
|
||||||
) ORDER BY 1 LIMIT 3;
|
) ORDER BY 1 LIMIT 3;
|
||||||
|
|
|
@ -164,7 +164,7 @@ SELECT * FROM set_view_pushdown ORDER BY 1 DESC;
|
||||||
|
|
||||||
-- this should be recursively planned
|
-- this should be recursively planned
|
||||||
CREATE VIEW set_view_recursive_second AS SELECT u.x, test.y FROM ((SELECT x, y FROM test) UNION (SELECT 1, 1 FROM test)) u JOIN test USING (x) ORDER BY 1,2;
|
CREATE VIEW set_view_recursive_second AS SELECT u.x, test.y FROM ((SELECT x, y FROM test) UNION (SELECT 1, 1 FROM test)) u JOIN test USING (x) ORDER BY 1,2;
|
||||||
SELECT * FROM set_view_recursive_second;
|
SELECT * FROM set_view_recursive_second ORDER BY 1,2;
|
||||||
|
|
||||||
-- this should create lots of recursive calls since both views and set operations lead to recursive plans :)
|
-- this should create lots of recursive calls since both views and set operations lead to recursive plans :)
|
||||||
((SELECT x FROM set_view_recursive_second) INTERSECT (SELECT * FROM set_view_recursive)) EXCEPT (SELECT * FROM set_view_pushdown);
|
((SELECT x FROM set_view_recursive_second) INTERSECT (SELECT * FROM set_view_recursive)) EXCEPT (SELECT * FROM set_view_pushdown);
|
||||||
|
|
Loading…
Reference in New Issue