v.25.10New Feature
Add LIMIT BY ALL syntax
AddedLIMIT BY ALLsyntax support. Similar toGROUP BY ALLandORDER BY ALL,LIMIT BY ALLautomatically expands to use all non-aggregate expressions from the SELECT clause as LIMIT BY keys. For example,SELECT id, name, count(*) FROM table GROUP BY id LIMIT 1 BY ALLis equivalent toSELECT id, name, count(*) FROM table GROUP BY id LIMIT 1 BY id, name. This feature simplifies queries when you want to limit by all selected non-aggregate columns without explicitly listing them. Closes #59152. #84079 (Surya Kant Ranjan).
Why it matters
This feature simplifies queries by eliminating the need to explicitly specify all non-aggregate columns in theLIMIT BY clause. It reduces query verbosity and potential errors when limiting results by all selected non-aggregate columns.How to use it
Use the syntaxLIMIT n BY ALL in your query to limit the output by all non-aggregate expressions in the SELECT clause. For example:SELECT id, name, count() FROM table GROUP BY id LIMIT 1 BY ALLThis is equivalent to:
SELECT id, name, count() FROM table GROUP BY id LIMIT 1 BY id, name