v3-0002-questions.patch

text/x-patch

Filename: v3-0002-questions.patch
Type: text/x-patch
Part: 0
Message: Re: enable_incremental_sort changes query behavior

Patch

Format: format-patch
Series: patch v3-0002
Subject: questions
File+
src/backend/optimizer/plan/planner.c 16 0
From eb494a83c0aba4b63fb44a34f7c06536ed131e5b Mon Sep 17 00:00:00 2001
From: James Coleman <jtc331@gmail.com>
Date: Sat, 3 Oct 2020 22:05:08 -0400
Subject: [PATCH v3 2/2] questions

---
 src/backend/optimizer/plan/planner.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index b7377c0c92..76b02232cb 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -5021,6 +5021,10 @@ create_ordered_paths(PlannerInfo *root,
 														root->sort_pathkeys,
 														limit_tuples);
 				/* Add projection step if needed */
+				/* TODO: why don't we apply the projection to the path
+				 * before sorting? Is it because it's already been done
+				 * by apply_scanjoin_target_to_paths?
+				 */
 				if (sorted_path->pathtarget != target)
 					sorted_path = apply_projection_to_path(root, ordered_rel,
 														   sorted_path, target);
@@ -5051,6 +5055,10 @@ create_ordered_paths(PlannerInfo *root,
 																limit_tuples);
 
 			/* Add projection step if needed */
+			/* TODO: why don't we apply the projection to the path
+			 * before sorting? Is it because it's already been done
+			 * by apply_scanjoin_target_to_paths?
+			 */
 			if (sorted_path->pathtarget != target)
 				sorted_path = apply_projection_to_path(root, ordered_rel,
 													   sorted_path, target);
@@ -5102,6 +5110,10 @@ create_ordered_paths(PlannerInfo *root,
 										 &total_groups);
 
 			/* Add projection step if needed */
+			/* TODO: why can't we apply the projection to the partial
+			 * path? Is it because it's already been done if possible
+			 * by apply_scanjoin_target_to_paths?
+			 */
 			if (path->pathtarget != target)
 				path = apply_projection_to_path(root, ordered_rel,
 												path, target);
@@ -5163,6 +5175,10 @@ create_ordered_paths(PlannerInfo *root,
 											 &total_groups);
 
 				/* Add projection step if needed */
+				/* TODO: why can't we apply the projection to the partial
+				 * path? Is it because it's already been done if possible
+				 * by apply_scanjoin_target_to_paths?
+				 */
 				if (sorted_path->pathtarget != target)
 					sorted_path = apply_projection_to_path(root, ordered_rel,
 														   sorted_path, target);
-- 
2.17.1