optimize_skip_merged_partitions
Enables or disables optimization for OPTIMIZE TABLE … FINAL query if there is only one part with level > 0 and it doesn’t have expired TTL.OPTIMIZE TABLE ... FINAL SETTINGS optimize_skip_merged_partitions=1
OPTIMIZE TABLE ... FINAL query rewrites the one part even if there is only a single part.
Possible values:
- 1 - Enable optimization.
- 0 - Disable optimization.
optimize_skip_unused_shards
Enables or disables skipping of unused shards for SELECT queries that have sharding key condition inWHERE/PREWHERE, and activates related optimizations for distributed queries (e.g. aggregation by sharding key).
Assumes that the data is distributed by sharding key, otherwise a query yields incorrect result.
- 0 — Disabled.
- 1 — Enabled.
optimize_skip_unused_shards_limit
Limit for number of sharding key values, turns offoptimize_skip_unused_shards if the limit is reached.
Too many values may require significant amount for processing, while the benefit is doubtful, since if you have huge number of values in IN (...), then most likely the query will be sent to all shards anyway.
optimize_skip_unused_shards_nesting
Controlsoptimize_skip_unused_shards (hence still requires optimize_skip_unused_shards) depends on the nesting level of the distributed query (case when you have Distributed table that look into another Distributed table).
Possible values:
- 0 — Disabled,
optimize_skip_unused_shardsworks always. - 1 — Enables
optimize_skip_unused_shardsonly for the first level. - 2 — Enables
optimize_skip_unused_shardsup to the second level.
optimize_skip_unused_shards_rewrite_in
Rewrite IN in query for remote shards to exclude values that does not belong to the shard (requires optimize_skip_unused_shards). Possible values:- 0 — Disabled.
- 1 — Enabled.