-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
Optimize queries like
SELECT count(DISTINCT col) > 1 FROM table;For cases where col has high cardinality. The issue is that currently the distinct accumulates all values first and only then are they counted, so we both insert values into the distinct accumulator, leaving CPU on the table, and we pay for memory unnecessarily.
Describe the solution you'd like
Add a bound to count distinct and only insert into the tracked values collection up to N+1.
Describe alternatives you've considered
n/a
Additional context
I have a prototype of this working, if the general idea sounds good, I can clean it up and submit the PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request