For the compound NDV case for n fields, we store n + 1 sketches. One sketch for all-$expr semantics, and one sketch for each field i where that field has $eq semantics and the others $expr.
We should actually store n + 2 sketches, adding a sketch for the all-$eq variant. This was an oversight during the HLL design, because we thought callers would only be interested in compound NDV stats where at most 1 field uses $eq semantics. However, this call for NDV from INLJ costing code actually ideally wants NDV information with $eq semantics (because indexes do map null/missing to the same key).
We found that for TPC-E, that specific NDV call takes up to 1ms on average, which would almost entirely disappear if it could be served from a persisted HLL estimate.
- related to
-
SERVER-134541 Request NDV with $expr semantics in INLJ costing
-
- Closed
-