Underestimated row count for rank window function #81831
Labels
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-queries
SQL Queries Team
Projects
Describe the problem
A query with a predicate
rank_window_function_result = 1
is returning an estimate of 1 row, but the answer should be taking into account the number of distinct values in the PARTITION BY columns and ORDER BY columns. If there are subsequent joins in the query, a sub-optimal join plan may be picked to evaluate those joins due to the bad estimate.To Reproduce
The esimated row count after the filter is 1, but it should be 100000.
Jira issue: CRDB-16087
The text was updated successfully, but these errors were encountered: