Skip to content

Commit 09a4ecf

Browse files
author
hackorum
committed
Apply get_parameterized_baserel_size.patch
1 parent 9e7d152 commit 09a4ecf

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5639,6 +5639,7 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
56395639
{
56405640
List *allclauses;
56415641
double nrows;
5642+
double nrows2;
56425643

56435644
/*
56445645
* Estimate the number of rows returned by the parameterized scan, knowing
@@ -5653,7 +5654,19 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
56535654
rel->relid, /* do not use 0! */
56545655
JOIN_INNER,
56555656
NULL);
5657+
5658+
nrows2 = rel->rows *
5659+
clauselist_selectivity(root,
5660+
param_clauses,
5661+
rel->relid, /* do not use 0! */
5662+
JOIN_INNER,
5663+
NULL);
56565664
nrows = clamp_row_est(nrows);
5665+
nrows2 = clamp_row_est(nrows2);
5666+
5667+
if (nrows != nrows2)
5668+
elog(NOTICE, "nrows = %g, nrows2 = %g", nrows, nrows2);
5669+
56575670
/* For safety, make sure result is not more than the base estimate */
56585671
if (nrows > rel->rows)
56595672
nrows = rel->rows;

0 commit comments

Comments
 (0)