Restrictions on Query Complexity | ClickHouse Documentation
clickhouse.com › docs › enThat is, a syntactic tree that is too deep can be created during parsing, but the query will fail. By default, 1000. max_ast_elements A maximum number of elements in a query syntactic tree. If exceeded, an exception is thrown. In the same way as the previous setting, it is checked only after parsing the query. By default, 50,000. max_rows_in_set
Settings | ClickHouse Documentation
clickhouse.com › docs › enmax_query_size The maximum part of a query that can be taken to RAM for parsing with the SQL parser. The INSERT query also contains data for INSERT that is processed by a separate stream parser (that consumes O(1) RAM), which is not included in this restriction. Default value: 256 KiB. max_parser_depth