forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcc9daa0

Richard Guo
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.com1 parentca1ba50 commitcc9daa0
1 file changed
+4
-0
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1382 | 1382 |
| |
1383 | 1383 |
| |
1384 | 1384 |
| |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
1385 | 1389 |
| |
1386 | 1390 |
| |
1387 | 1391 |
| |
|
0 commit comments
Comments
(0)