v.21.7Improvement
Enhancement of Distributed Query: Support for Single-Element Tuples with optimize_skip_unused_shards=1
For distributed query, whenoptimize_skip_unused_shards=1, allow to skip shard with condition like(sharding key) IN (one-element-tuple). (Tuples with many elements were supported. Tuple with single element did not work because it is parsed as literal). #24930 (Amos Bird).
Why it matters
This feature fixes an issue where shard skipping did not work for conditions using a single-element tuple with the sharding key in distributed queries. Previously, only multi-element tuples were supported, and single-element tuples were treated as literals, preventing shard skipping optimization. This enhancement allows more efficient query execution by properly skipping unused shards when the sharding key condition is a single-element tuple.How to use it
Enable shard skipping optimization by setting the settingoptimize_skip_unused_shards=1. Then, use a condition on the sharding key in the form of a single-element tuple, e.g., (sharding_key) IN (('value')), in your distributed query to skip irrelevant shards automatically.