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

Commitfa86238

Browse files
committed
Speed up match_eclasses_to_foreign_key_col() when there are many ECs.
Check ec_relids before bothering to iterate through the EC members.On a perhaps extreme, but still real-world, query in whichmatch_eclasses_to_foreign_key_col() accounts for the bulk of theplanner's runtime, this saves nearly 40% of the runtime. It's a bitof a stopgap fix, but it's simple enough to be back-patched to 9.6where this code came in; so let's do that.David RowleyDiscussion:https://postgr.es/m/6970.1545327857@sss.pgh.pa.us
1 parentd26a810 commitfa86238

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/backend/optimizer/path/equivclass.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,14 @@ match_eclasses_to_foreign_key_col(PlannerInfo *root,
20522052
continue;
20532053
/* Note: it seems okay to match to "broken" eclasses here */
20542054

2055+
/*
2056+
* If eclass visibly doesn't have members for both rels, there's no
2057+
* need to grovel through the members.
2058+
*/
2059+
if (!bms_is_member(var1varno,ec->ec_relids)||
2060+
!bms_is_member(var2varno,ec->ec_relids))
2061+
continue;
2062+
20552063
foreach(lc2,ec->ec_members)
20562064
{
20572065
EquivalenceMember*em= (EquivalenceMember*)lfirst(lc2);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp