fdb-record-layer
fdb-record-layer copied to clipboard
Estimating cardinality for aggregate index plans is incorrect for some cases
When estimating the cardinality for an aggregate index plan, we check whether the equality-bound ordering values contain the grouping value(s), if so we estimate the cardinality to be either 0 or 1 (because we have at most one group).
The estimation is however, incorrect because the grouping value is not deconstructed properly.
if (ordering.getEqualityBoundValues().contains(groupingValue)) {
return new Cardinalities(Cardinality.ofCardinality(0L), Cardinality.ofCardinality(1L));
}