mergejoin-cost-estimate-thinko.patch
text/x-diff
Filename: mergejoin-cost-estimate-thinko.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/optimizer/path/costsize.c | 0 | 0 |
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 7bf67a0..480fd25 100644 *** a/src/backend/optimizer/path/costsize.c --- b/src/backend/optimizer/path/costsize.c *************** final_cost_mergejoin(PlannerInfo *root, *** 2941,2948 **** if (rescannedtuples < 0) rescannedtuples = 0; } ! /* We'll inflate various costs this much to account for rescanning */ ! rescanratio = 1.0 + (rescannedtuples / inner_path_rows); /* * Decide whether we want to materialize the inner input to shield it from --- 2941,2953 ---- if (rescannedtuples < 0) rescannedtuples = 0; } ! ! /* ! * 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 *************** final_cost_mergejoin(PlannerInfo *root, *** 2969,2975 **** * of the generated Material node. */ mat_inner_cost = inner_run_cost + ! cpu_operator_cost * inner_path_rows * rescanratio; /* * If we don't need mark/restore at all, we don't need materialization. --- 2974,2980 ---- * of the generated Material node. */ mat_inner_cost = inner_run_cost + ! cpu_operator_cost * inner_rows * rescanratio; /* * If we don't need mark/restore at all, we don't need materialization.