v6-0003-questions.patch

text/x-patch

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

Patch

Format: format-patch
Series: patch v6-0003
Subject: questions
File+
src/backend/optimizer/plan/planner.c 16 0
From b81e133200086058cf2c8f683e31a643cc32aea7 Mon Sep 17 00:00:00 2001
From: James Coleman <jtc331@gmail.com>
Date: Sat, 3 Oct 2020 22:05:08 -0400
Subject: [PATCH v6 3/3] 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 6989c5c0e3..f78bbcec02 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -5018,6 +5018,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);
@@ -5048,6 +5052,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);
@@ -5099,6 +5107,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);
@@ -5160,6 +5172,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