Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

optimize_skip_* session settings

These settings are available in system.settings and are autogenerated from source.

optimize_skip_merged_partitions

Type
Bool
Default
0

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

By default, 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

Type
Bool
Default
0

Enables or disables skipping of unused shards for SELECT queries that have sharding key condition in WHERE/PREWHERE, and activates related optimizations for distributed queries (e.g. aggregation by sharding key).

Possible values:

  • 0 — Disabled.
  • 1 — Enabled.

optimize_skip_unused_shards_limit

Type
UInt64
Default
1000

Limit for number of sharding key values, turns off optimize_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

Type
UInt64
Default
0

Controls optimize_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_shards works always.
  • 1 — Enables optimize_skip_unused_shards only for the first level.
  • 2 — Enables optimize_skip_unused_shards up to the second level.

optimize_skip_unused_shards_rewrite_in

Type
Bool
Default
1

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.
Navigation