Skip to content

Commit 12d8074

Browse files
committed
Postfix for the improved selectivity estimations, thanks to Denis Simonov
1 parent 61354ae commit 12d8074

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/jrd/optimizer/Optimizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,8 @@ double Optimizer::estimateSelectivity(const BooleanList& filters, double cardina
12401240
// If the table is small enough, the hardcoded selectivity factors are causing
12411241
// too small resulting selectivity. Adjust the initial value to protect from this case.
12421242
const auto minSelectivity = MAXIMUM_SELECTIVITY / cardinality;
1243-
selectivity *= minSelectivity / selectivities.front();
1243+
if (selectivities.front() < minSelectivity)
1244+
selectivity *= minSelectivity / selectivities.front();
12441245
}
12451246

12461247
// Apply exponential backoff

0 commit comments

Comments
 (0)