v.21.3New Feature

New Query Concurrency Control Settings for MergeTree Engine in Tables

Tables with MergeTree* engine now have two new table-level settings for query concurrency control. Setting max_concurrent_queries limits the number of concurrently executed queries which are related to this table. Setting min_marks_to_honor_max_concurrent_queries tells to apply previous setting only if query reads at least this number of marks. #19544 (Amos Bird).
Tables with the MergeTree* engine now support two new table-level settings to control query concurrency: max_concurrent_queries and min_marks_to_honor_max_concurrent_queries.

Why it matters

These settings allow limiting the number of concurrently executed queries related to a specific table, helping to prevent resource contention and improve cluster stability. The min_marks_to_honor_max_concurrent_queries setting ensures that the concurrency limit applies only to queries reading a significant amount of data (measured in marks), avoiding unnecessary restriction of lightweight queries.

How to use it

Users can configure these settings at the table level by setting max_concurrent_queries to limit concurrent queries for that table and min_marks_to_honor_max_concurrent_queries to specify the minimum number of marks a query must read for the concurrency limit to apply. This can be done via the ALTER TABLE command or during table creation.