v.21.6New Feature

Added max_distributed_depth Setting for Recursive Queries on Distributed Tables

Added a setting max_distributed_depth that limits the depth of recursive queries to Distributed tables. Closes #20229. #21942 (flynn).
Introduced the max_distributed_depth setting to limit the recursion depth of queries involving Distributed tables.

Why it matters

This feature prevents excessively deep or potentially infinite recursive queries on Distributed tables, improving query stability and protecting server resources from overload caused by deep distributed query chains.

How to use it

Set the max_distributed_depth configuration parameter to an integer value representing the maximum allowed recursive depth for queries on Distributed tables. For example, in the server configuration or client session, specify:

SET max_distributed_depth = <desired_depth>;