Skip to content

Planner over/under estimates selectivity for IN/ NOT IN predicates #26808

@aaneja

Description

@aaneja

See aaneja@b25137b for repro tests

Current Behavior

Filter stats is estimate to 0 for certain NOT IN clauses

  • Case 1 : NDV is unknown and range estimation returns 0.5 (the INFINITE_TO_INFINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR) as the range overlap. For >=2 values in the IN clause the NOT IN resorts to zero estimate
  • Case 2 : NDV is known, but the IN list has more values than the variable's NDV. For in list values >= the NDV value, we get a zero estimate

Expected Behavior

A non-zero filter selectivity for NOT IN
For IN predicates, filter selectivity is never for the full range

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

🆕 Unprioritized

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions