onur-leftjoin_push-improvements
eaydingol 2025-07-31 16:51:41 +03:00
parent bca534cb3e
commit 665ae75a65
2 changed files with 8 additions and 3 deletions

View File

@ -2397,16 +2397,21 @@ SELECT coordinator_plan($$
EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT id, (SELECT id FROM ref_table_1 WHERE id = 1) FROM ref_table_1; EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT id, (SELECT id FROM ref_table_1 WHERE id = 1) FROM ref_table_1;
$$); $$);
-- verify that insert select cannot be pushed down when we have reference table in outside of outer join. -- verify that insert select can be pushed down when we have reference table in outside of outer join.
SELECT coordinator_plan($$ SELECT coordinator_plan($$
EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT a.id FROM dist_table_5 a LEFT JOIN ref_table_1 b ON (true) RIGHT JOIN ref_table_1 c ON (true); EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT a.id FROM dist_table_5 a LEFT JOIN ref_table_1 b ON (true) RIGHT JOIN ref_table_1 c ON (true);
$$); $$);
-- verify that insert select cannot be pushed down when it has a recurring outer join in a subquery. -- verify that insert select can be pushed down when we have reference table in outside of left join.
SELECT coordinator_plan($$ SELECT coordinator_plan($$
EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT id FROM ref_table_1 LEFT JOIN dist_table_5 USING(id); EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT id FROM ref_table_1 LEFT JOIN dist_table_5 USING(id);
$$); $$);
-- verify that insert select cannot be pushed down when we have reference table in outside of left join and joined on non-distribution column.
SELECT coordinator_plan($$
EXPLAIN (COSTS FALSE) INSERT INTO dist_table_5 SELECT ref_table_1.id FROM ref_table_1 LEFT JOIN dist_table_5 ON ref_table_1.id = dist_table_5.id2;
$$);
CREATE TABLE loc_table_1(id int); CREATE TABLE loc_table_1(id int);
-- verify that insert select cannot be pushed down when it contains join between local and distributed tables. -- verify that insert select cannot be pushed down when it contains join between local and distributed tables.

View File

@ -260,7 +260,7 @@ SELECT user_id, value_2 FROM users_table WHERE
) )
ORDER BY 1, 2; ORDER BY 1, 2;
-- reference table LEFT JOIN distributed table in WHERE is still not ok -- reference table LEFT JOIN distributed table in WHERE is ok
SELECT user_id, value_2 FROM users_table WHERE SELECT user_id, value_2 FROM users_table WHERE
value_1 > 1 AND value_1 < 3 value_1 > 1 AND value_1 < 3
AND value_2 >= 5 AND value_2 >= 5