v.22.4Improvement
Proper handling of max_rows_to_read in sorted query limits
Proper support of settingmax_rows_to_readin case of reading in order of sorting key and specified limit. Previously the exceptionLimit for rows or bytes to read exceededcould be thrown even if query actually requires to read less amount of rows. #33230 (Anton Popov).
Why it matters
This feature addresses the issue where an exception (Limit for rows or bytes to read exceeded) could be incorrectly thrown even though the query logically requires reading fewer rows. It ensures that the max_rows_to_read limit accurately reflects the actual number of rows needed, improving query reliability and predictability.How to use it
Users can rely on themax_rows_to_read setting during query execution involving ordered reads with LIMIT clauses without additional adjustments. The improved logic is applied automatically to avoid premature exceptions.