We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0afdc1 commit f4dcaabCopy full SHA for f4dcaab
postprocessing.c
@@ -304,7 +304,13 @@ learnOnPlanState(PlanState *p, void *context)
304
* to calculate produced rows. */
305
learn_rows = p->instrument->ntuples / p->instrument->nloops;
306
307
- if (p->plan->predicted_cardinality > 0.)
+ /*
308
+ * Calculate predicted cardinality.
309
+ * We could find a positive value of predicted cardinality in
310
+ * the case of reusing plan caused by the rewriting procedure.
311
+ * Also it may be caused by using of a generic plan.
312
+ */
313
+ if (p->plan->predicted_cardinality > 0. && query_context.use_aqo)
314
predicted = p->plan->predicted_cardinality;
315
else if (IsParallelTuplesProcessing(p->plan))
316
predicted = p->plan->plan_rows *
0 commit comments