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
Use case If query contains GROUP BY but no aggregate functions and also contains LIMIT, remove GROUP BY and add DISTINCT.
SELECT a, b, c FROM t GROUP BY a, b, c LIMIT 10
->
SELECT DISTINCT a, b, c FROM t LIMIT 10
This optimization is viable, because DISTINCT can output records without waiting for full result and it can stop earlier in presence of LIMIT.
But if LIMIT is not present, DISTINCT is less efficient than GROUP BY due to lack of some specializations.
PS. Advanced version:
SELECT a, b, c, any(x), any(y) FROM t GROUP BY a, b, c LIMIT 10
SELECT a, b, c, x, y FROM t LIMIT 1 BY a, b, c
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Use case
If query contains GROUP BY but no aggregate functions and also contains LIMIT, remove GROUP BY and add DISTINCT.
->
This optimization is viable, because DISTINCT can output records without waiting for full result and it can stop earlier in presence of LIMIT.
But if LIMIT is not present, DISTINCT is less efficient than GROUP BY due to lack of some specializations.
PS. Advanced version:
->
The text was updated successfully, but these errors were encountered: