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

Commitcc9daa0

Browse files
author
Richard Guo
committed
Short-circuit sort_inner_and_outer if there are no mergejoin clauses
In sort_inner_and_outer, we create mergejoin join paths by explicitlysorting both relations on each possible ordering of the availablemergejoin clauses. However, if there are no available mergejoinclauses, we can skip this process entirely.This patch introduces a check for mergeclause_list at the beginning ofsort_inner_and_outer and exits the function if it is found to beempty. This might help skip all the statements that come before thecall to select_outer_pathkeys_for_merge, including the build ofUniquePaths in the case of JOIN_UNIQUE_OUTER or JOIN_UNIQUE_INNER.I doubt there's any measurable performance improvement, but throughoutthe run of the regression tests, sort_inner_and_outer is called atotal of 44,424 times. Among these calls, there are 11,064 instanceswhere mergeclause_list is found to be empty, which accounts forapproximately one-fourth. I think this suggests that implementingthis shortcut is worthwhile.Author: Richard GuoReviewed-by: Ashutosh BapatDiscussion:https://postgr.es/m/CAMbWs48RKiZGFEd5A0JtztRY5ZdvVvNiHh0AKeuoz21F+0dVjQ@mail.gmail.com
1 parentca1ba50 commitcc9daa0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,10 @@ sort_inner_and_outer(PlannerInfo *root,
13821382
List*all_pathkeys;
13831383
ListCell*l;
13841384

1385+
/* Nothing to do if there are no available mergejoin clauses */
1386+
if (extra->mergeclause_list==NIL)
1387+
return;
1388+
13851389
/*
13861390
* We only consider the cheapest-total-cost input paths, since we are
13871391
* assuming here that a sort is required. We will consider

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp