Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2cbbfff

Browse files
committed
Remove leftover code in deconstruct_distribute_oj_quals().
The initial "put back OJ relids" adjustment of ojscope wasincorrect and unnecessary; it seems to be a leftover fromwhen I (tgl) was trying to get this function to work at all.Richard GuoDiscussion:https://postgr.es/m/CAMbWs4-L2C47ZGZPabBAi5oDZsKmsbvhYcGCy5o=gCjsaG_ZQA@mail.gmail.com
1 parentaa69541 commit2cbbfff

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

‎src/backend/optimizer/plan/initsplan.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,13 +1903,6 @@ deconstruct_distribute_oj_quals(PlannerInfo *root,
19031903
intsave_last_rinfo_serial;
19041904
ListCell*lc;
19051905

1906-
/*
1907-
* Put any OJ relids that were removed from min_righthand back into
1908-
* ojscope, else distribute_qual_to_rels will complain.
1909-
*/
1910-
ojscope=bms_join(ojscope,bms_intersect(sjinfo->commute_below,
1911-
sjinfo->syn_righthand));
1912-
19131906
/* Identify the outer joins this one commutes with */
19141907
joins_above=sjinfo->commute_above_r;
19151908
joins_below=bms_intersect(sjinfo->commute_below,

‎src/test/regress/expected/join.out

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4982,6 +4982,32 @@ select id from a where id in (
49824982
-> Seq Scan on b
49834983
(5 rows)
49844984

4985+
-- check optimization with oddly-nested outer joins
4986+
explain (costs off)
4987+
select a1.id from
4988+
(a a1 left join a a2 on true)
4989+
left join
4990+
(a a3 left join a a4 on a3.id = a4.id)
4991+
on a2.id = a3.id;
4992+
QUERY PLAN
4993+
------------------------------
4994+
Nested Loop Left Join
4995+
-> Seq Scan on a a1
4996+
-> Materialize
4997+
-> Seq Scan on a a2
4998+
(4 rows)
4999+
5000+
explain (costs off)
5001+
select a1.id from
5002+
(a a1 left join a a2 on a1.id = a2.id)
5003+
left join
5004+
(a a3 left join a a4 on a3.id = a4.id)
5005+
on a2.id = a3.id;
5006+
QUERY PLAN
5007+
------------------
5008+
Seq Scan on a a1
5009+
(1 row)
5010+
49855011
-- check that join removal works for a left join when joining a subquery
49865012
-- that is guaranteed to be unique by its GROUP BY clause
49875013
explain (costs off)

‎src/test/regress/sql/join.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,6 +1770,21 @@ select id from a where id in (
17701770
selectb.idfrom bleft join conb.id=c.id
17711771
);
17721772

1773+
-- check optimization with oddly-nested outer joins
1774+
explain (costs off)
1775+
selecta1.idfrom
1776+
(a a1left join a a2on true)
1777+
left join
1778+
(a a3left join a a4ona3.id=a4.id)
1779+
ona2.id=a3.id;
1780+
1781+
explain (costs off)
1782+
selecta1.idfrom
1783+
(a a1left join a a2ona1.id=a2.id)
1784+
left join
1785+
(a a3left join a a4ona3.id=a4.id)
1786+
ona2.id=a3.id;
1787+
17731788
-- check that join removal works for a left join when joining a subquery
17741789
-- that is guaranteed to be unique by its GROUP BY clause
17751790
explain (costs off)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp