v.21.1New Features

New Storage Setting for MergeTree Tables: max_partitions_to_read and User Setting force_max_partition_limit

Now we have a new storage setting max_partitions_to_read for tables in the MergeTree family. It limits the max number of partitions that can be accessed in one query. A user setting force_max_partition_limit is also added to enforce this constraint. #18712 (Amos Bird).
Introduces a new storage setting max_partitions_to_read for MergeTree tables that limits the maximum number of partitions accessed by a single query.

Why it matters

This feature helps prevent queries from scanning too many partitions at once, which can improve query performance and resource management by avoiding overly expensive or potentially runaway queries. The related user setting force_max_partition_limit allows enforcing this partition access limit.

How to use it

Set the max_partitions_to_read setting on MergeTree family tables to define the maximum allowed partitions to read in one query. Enable the force_max_partition_limit user setting to enforce this constraint strictly, causing queries that exceed the limit to fail.