Skip to content

Commit 492c9cd

Browse files
author
hackorum
committed
Apply get_parameterized_baserel_size.patch
1 parent b597835 commit 492c9cd

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
@@ -5548,6 +5548,7 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
55485548
{
55495549
List *allclauses;
55505550
double nrows;
5551+
double nrows2;
55515552

55525553
/*
55535554
* Estimate the number of rows returned by the parameterized scan, knowing
@@ -5562,7 +5563,19 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel,
55625563
rel->relid, /* do not use 0! */
55635564
JOIN_INNER,
55645565
NULL);
5566+
5567+
nrows2 = rel->rows *
5568+
clauselist_selectivity(root,
5569+
param_clauses,
5570+
rel->relid, /* do not use 0! */
5571+
JOIN_INNER,
5572+
NULL);
55655573
nrows = clamp_row_est(nrows);
5574+
nrows2 = clamp_row_est(nrows2);
5575+
5576+
if (nrows != nrows2)
5577+
elog(NOTICE, "nrows = %g, nrows2 = %g", nrows, nrows2);
5578+
55665579
/* For safety, make sure result is not more than the base estimate */
55675580
if (nrows > rel->rows)
55685581
nrows = rel->rows;

0 commit comments

Comments
 (0)