We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DISTINCT aggs like COUNT DISTINCT are expensive. But in most cases it is helpful to push down these as group by keys before counting them.
SELECT agg(x), COUNT(DISTINCT y) FROM T GROUP BY z;
can be rewritten as
SELECT agg(x), COUNT(DISTINCT y) FROM (SELECT partial_agg(x) AS x, y, z FROM T GROUP BY y, z) AS T GROUP BY z;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
DISTINCT aggs like COUNT DISTINCT are expensive. But in most cases it is helpful to push down these as group by keys before counting them.
SELECT agg(x), COUNT(DISTINCT y) FROM T GROUP BY z;
can be rewritten as
SELECT agg(x), COUNT(DISTINCT y) FROM (SELECT partial_agg(x) AS x, y, z FROM T GROUP BY y, z) AS T GROUP BY z;
The text was updated successfully, but these errors were encountered: