v.21.8Improvement

Add support for SET SQL_SELECT_LIMIT in MySQL protocol

Add support for SET SQL_SELECT_LIMIT in MySQL protocol. Closes #17115. #25972 (Kseniia Sumarokova).
Added support for the SET SQL_SELECT_LIMIT statement in the MySQL protocol for ClickHouse.

Why it matters

This feature enables ClickHouse to recognize and apply the SET SQL_SELECT_LIMIT command when interacting through the MySQL protocol, allowing users to limit the number of rows returned by a query. It improves compatibility with MySQL clients and helps control query result size directly via session settings.

How to use it

Users can execute the statement using SQL syntax through the MySQL protocol interface, for example:

SET SQL_SELECT_LIMIT = 1000;

This will limit the number of rows returned by subsequent queries in the same session to 1000.