aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/path/costsize.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 7bf67a05295..480fd250e93 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -2941,8 +2941,13 @@ final_cost_mergejoin(PlannerInfo *root, MergePath *path,
if (rescannedtuples < 0)
rescannedtuples = 0;
}
- /* We'll inflate various costs this much to account for rescanning */
- rescanratio = 1.0 + (rescannedtuples / inner_path_rows);
+
+ /*
+ * We'll inflate various costs this much to account for rescanning. Note
+ * that this is to be multiplied by something involving inner_rows, or
+ * another number related to the portion of the inner rel we'll scan.
+ */
+ rescanratio = 1.0 + (rescannedtuples / inner_rows);
/*
* Decide whether we want to materialize the inner input to shield it from
@@ -2969,7 +2974,7 @@ final_cost_mergejoin(PlannerInfo *root, MergePath *path,
* of the generated Material node.
*/
mat_inner_cost = inner_run_cost +
- cpu_operator_cost * inner_path_rows * rescanratio;
+ cpu_operator_cost * inner_rows * rescanratio;
/*
* If we don't need mark/restore at all, we don't need materialization.