v.20.3New Feature

Add Setting to Force Error on Skipping Unused Shards

Add a setting force_optimize_skip_unused_shards setting to throw if skipping of unused shards is not possible #8805 (Azat Khuzhin)
Introduces the force_optimize_skip_unused_shards setting to enforce failure when skipping unused shards during query execution is not possible.

Why it matters

This feature addresses cases where queries attempt to optimize performance by skipping unused shards, but such skipping cannot always be done safely or effectively. By enabling this setting, users can ensure that queries will throw an error instead of silently proceeding without skipping shards, thereby improving correctness and predictability in shard optimization.

How to use it

Set the force_optimize_skip_unused_shards setting to true in your query or session settings. When enabled, if ClickHouse cannot skip unused shards, it will throw an error instead of continuing the query normally. Example usage in SQL:

SET force_optimize_skip_unused_shards = 1;
SELECT * FROM your_distributed_table;