Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for ClickHouse®
  • Getting started
    • Resource relationships
    • High availability clusters
    • Host classes
    • Networking in Managed Service for ClickHouse®
    • Quotas and limits
    • Storage
    • Backups
    • Replication
    • Coordination services
    • Dictionaries
    • Sharding
    • Maintenance
    • Managing users and access permissions
    • Supported clients
    • Memory management
    • ClickHouse® versioning policy
    • ClickHouse® settings
  • Access management
  • Inspections and recommendations
  • Pricing policy
  • Terraform reference
  • Yandex Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Sharding specifics in Managed Service for ClickHouse®
  • Sharding management in Managed Service for ClickHouse®
  • Replication in a sharded Managed Service for ClickHouse® cluster
  1. Concepts
  2. Sharding

Sharding in Managed Service for ClickHouse®

Written by
Yandex Cloud
Updated at September 14, 2026
View in Markdown
  • Sharding specifics in Managed Service for ClickHouse®
  • Sharding management in Managed Service for ClickHouse®
  • Replication in a sharded Managed Service for ClickHouse® cluster

Sharding in ClickHouse® is a horizontal cluster scaling strategy that splits data into a number of logical parts called shards. Each shard can consist of a single host or multiple replica hosts.

Advantages of sharding:

  • Horizontal scaling enables you to bypass the limits of a single server in terms of CPU, RAM, disk space, and I/O throughput.
  • Parallel query execution, where you run queries against the same logical table across different shards, allows you to balance the load, reduce resource contention, and accelerate read and write operations.

Sharding specifics in Managed Service for ClickHouse®Sharding specifics in Managed Service for ClickHouse®

To implement distributed storage of table data in Managed Service for ClickHouse®, you need to create:

  1. Identical local tables on the MergeTree family engine across multiple cluster shards.
  2. Distributed table on the Distributed engine that uses these shards.

Each local table stores some of the rows from the distributed dataset. The distributed table routes queries to the local tables but stores no data.

The system distributes data across shards using a sharding key. During an INSERT query, the distributed table calculates the sharding key value and routes the query to the relevant local table. The sharding key is defined when creating the distributed table. Examples of sharding keys include table fields, calculated expressions, and random distribution functions.

Choosing the right sharding key is important because it controls:

  • How evenly your data is distributed across shards.
  • How efficient queries are.

Note

Unlike INSERT, SELECT queries target all cluster shards regardless of the sharding key. To change this behavior, use the optimize_skip_unused_shards setting.

You can distribute table data across all cluster shards or their subset, i.e., a shard group. You can also create a distributed table either for all cluster shards or a specific shard group.

This enables you to flexibly manage sharding in a Managed Service for ClickHouse® cluster.

For examples of different sharding methods, see Table sharding in ClickHouse®.

Sharding management in Managed Service for ClickHouse®Sharding management in Managed Service for ClickHouse®

In Managed Service for ClickHouse®, you can create a sharded cluster or enable sharding for an existing cluster.

When you create a non-sharded cluster, the system automatically adds a single shard containing all cluster hosts. To enable sharding for an existing cluster, you need to add at least one more shard.

New sharded clusters can have two or more shards from the start. You can also add more shards to an existing sharded cluster.

Note

You cannot delete a host from a shard if the limit for the minimum number of hosts has been reached.

Replication in a sharded Managed Service for ClickHouse® clusterReplication in a sharded Managed Service for ClickHouse® cluster

In a sharded Managed Service for ClickHouse® cluster, replication is restricted to individual shards, not the entire cluster:

  • Each shard stores its own portion of the data.
  • All replicas within a single shard hold identical copies of that data portion.
  • There is no cross-replication of data between different shards.

In clusters with the coordination service enabled, replication is activated automatically when you create a shard with two or more hosts.

Note

You cannot create a shard with two or more hosts in clusters where the coordination service is disabled.

ClickHouse® is a registered trademark of ClickHouse, Inc.

Was the article helpful?

Previous
Dictionaries
Next
Maintenance
© 2026 Direct Cursus Technology L.L.C.