v.19.8New Features
Added LIMIT N, M BY or LIMIT M OFFSET N BY Syntax to Set Offset of N for LIMIT BY Clause
AddedLIMIT n, m BYorLIMIT m OFFSET n BYsyntax to set offset of n for LIMIT BY clause. #5138 (Anton Popov)
Why it matters
This feature enhances the flexibility of theLIMIT BY clause by enabling users to skip the first n rows within each group, effectively adding an offset. It solves the problem of being unable to paginate or offset results within groups when using LIMIT BY, which is useful for more granular control and advanced data querying scenarios.How to use it
Users can apply this feature by adding an offset before setting the limit in theLIMIT BY clause. For example: LIMIT 10, 5 BY key or LIMIT 5 OFFSET 10 BY key. This tells ClickHouse to skip the first 10 rows per group identified by key and then return the next 5 rows.