Skip to content

Commit 61d6dd0

Browse files
committed
Fix adjust_semi_join to be more cautious about clauseless joins.
It was reporting that these were fully indexed (hence cheap), when of course they're the exact opposite of that. I'm not certain if the case would arise in practice, since a clauseless semijoin is hard to produce in SQL, but if it did happen we'd make some dumb decisions.
1 parent 71baff1 commit 61d6dd0

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/backend/optimizer/path/costsize.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,12 +2897,20 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo,
28972897
*/
28982898
if (indexed_join_quals)
28992899
{
2900-
List *nrclauses;
2900+
if (path->joinrestrictinfo != NIL)
2901+
{
2902+
List *nrclauses;
29012903

2902-
nrclauses = select_nonredundant_join_clauses(root,
2903-
path->joinrestrictinfo,
2904-
path->innerjoinpath);
2905-
*indexed_join_quals = (nrclauses == NIL);
2904+
nrclauses = select_nonredundant_join_clauses(root,
2905+
path->joinrestrictinfo,
2906+
path->innerjoinpath);
2907+
*indexed_join_quals = (nrclauses == NIL);
2908+
}
2909+
else
2910+
{
2911+
/* a clauseless join does NOT qualify */
2912+
*indexed_join_quals = false;
2913+
}
29062914
}
29072915

29082916
return true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy