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

Commitaffee8b

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 parentddad002 commitaffee8b

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
@@ -2013,6 +2013,14 @@ match_eclasses_to_foreign_key_col(PlannerInfo *root,
20132013
continue;
20142014
/* Note: it seems okay to match to "broken" eclasses here */
20152015

2016+
/*
2017+
* If eclass visibly doesn't have members for both rels, there's no
2018+
* need to grovel through the members.
2019+
*/
2020+
if (!bms_is_member(var1varno,ec->ec_relids)||
2021+
!bms_is_member(var2varno,ec->ec_relids))
2022+
continue;
2023+
20162024
foreach(lc2,ec->ec_members)
20172025
{
20182026
EquivalenceMember*em= (EquivalenceMember*)lfirst(lc2);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp