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

Appearance settings

Commit 1ca2eb1

Browse filesBrowse files
committed
Improve find_em_expr_usable_for_sorting_rel comment
Clarify the relationship between find_em_expr_usable_for_sorting_rel and prepare_sort_from_pathkeys, i.e. what restrictions need to be shared between those two places. Author: James Coleman Reviewed-by: Tomas Vondra Backpatch-through: 13 Discussion: https://postgr.es/m/CAAaqYe8cK3g5CfLC4w7bs%3DhC0mSksZC%3DH5M8LSchj5e5OxpTAg%40mail.gmail.com
1 parent 9aff4dc commit 1ca2eb1
Copy full SHA for 1ca2eb1

File tree

Expand file treeCollapse file tree

2 files changed

+8
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/backend/optimizer/path/equivclass.c
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,9 +798,11 @@ find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel)
798798
}
799799

800800
/*
801-
* Find an equivalence class member expression that can be safely used by a
802-
* sort node on top of the provided relation. The rules here must match those
803-
* applied in prepare_sort_from_pathkeys.
801+
* Find an equivalence class member expression that can be safely used to build
802+
* a sort node using the provided relation. The rules are a subset of those
803+
* applied in prepare_sort_from_pathkeys since that function deals with sorts
804+
* that must be delayed until the last stages of query execution, while here
805+
* we only care about proactive sorts.
804806
*/
805807
Expr *
806808
find_em_expr_usable_for_sorting_rel(PlannerInfo *root, EquivalenceClass *ec,

‎src/backend/optimizer/plan/createplan.c

Copy file name to clipboardExpand all lines: src/backend/optimizer/plan/createplan.c
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5850,6 +5850,9 @@ make_incrementalsort(Plan *lefttree, int numCols, int nPresortedCols,
58505850
*
58515851
* Returns the node which is to be the input to the Sort (either lefttree,
58525852
* or a Result stacked atop lefttree).
5853+
*
5854+
* Note: Restrictions on what expressions are safely sortable may also need to
5855+
* be added to find_em_expr_usable_for_sorting_rel.
58535856
*/
58545857
static Plan *
58555858
prepare_sort_from_pathkeys(Plan *lefttree, List *pathkeys,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.