[EPIC] A collection of Sort + Limit
/ Top K
optimizations
#7195
Labels
enhancement
New feature or request
Sort + Limit
/ Top K
optimizations
#7195
Is your feature request related to a problem or challenge?
This ticket has links a collection of various ways to make queries with
LIMIT
or various other variants (likerow_number()
predicates) both:These are typically called "Top K" style optimizations in databases and optimize the pattern of a sort followed by a limit
The observation is that if the
INPUT
is much larger than the fetch (aka theK
) it is much more efficient and less memory intensive to track the top10
values rather than sort the entire input and discard everything except the top10
Normally this done with special
ExecutionPlan
operators. What the operators do and behave depend on the exact query pattern.Describe the solution you'd like
ROW_NUMBER < 5
/ TopK #6899group by
cardinality, even when the aggregate output is truncated by alimit
clause #7191Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: