diff options
author | Richard Guo <rguo@postgresql.org> | 2025-05-08 18:21:32 +0900 |
---|---|---|
committer | Richard Guo <rguo@postgresql.org> | 2025-05-08 18:21:32 +0900 |
commit | c06e909c26f070dee78f73c35565d6f4a4ffdcda (patch) | |
tree | 9f69470d8ba03027f37796542b8c0e7bafb2f44e /src/include/optimizer/cost.h | |
parent | 773db22269d474fab46d25e9e15b1e55252cf92c (diff) | |
download | postgresql-c06e909c26f070dee78f73c35565d6f4a4ffdcda.tar.gz postgresql-c06e909c26f070dee78f73c35565d6f4a4ffdcda.zip |
Track the number of presorted outer pathkeys in MergePath
When creating an explicit Sort node for the outer path of a mergejoin,
we need to determine the number of presorted keys of the outer path to
decide whether explicit incremental sort can be applied. Currently,
this is done by repeatedly calling pathkeys_count_contained_in.
This patch caches the number of presorted outer pathkeys in MergePath,
allowing us to save several calls to pathkeys_count_contained_in. It
can be considered a complement to the changes in commit 828e94c9d.
Reported-by: David Rowley <dgrowleyml@gmail.com>
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAApHDvqvBireB_w6x8BN5txdvBEHxVgZBt=rUnpf5ww5P_E_ww@mail.gmail.com
Diffstat (limited to 'src/include/optimizer/cost.h')
-rw-r--r-- | src/include/optimizer/cost.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index c5987440817..d397fe27dc1 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -160,6 +160,7 @@ extern void initial_cost_mergejoin(PlannerInfo *root, List *mergeclauses, Path *outer_path, Path *inner_path, List *outersortkeys, List *innersortkeys, + int outer_presorted_keys, JoinPathExtraData *extra); extern void final_cost_mergejoin(PlannerInfo *root, MergePath *path, JoinCostWorkspace *workspace, |