fdb-record-layer icon indicating copy to clipboard operation
fdb-record-layer copied to clipboard

Estimating cardinality for aggregate index plans is incorrect for some cases

Open hatyo opened this issue 1 year ago • 0 comments

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));
        } 

hatyo avatar May 23 '23 14:05 hatyo