TECH_COMPARISON

Vitess vs CockroachDB: A Detailed Comparison for System Design

Vitess vs CockroachDB: compare MySQL sharding middleware with distributed PostgreSQL for horizontal scaling and global deployment.

18 minUpdated Apr 25, 2026
vitesscockroachdbdatabases

Vitess vs CockroachDB

Vitess and CockroachDB both solve horizontal database scaling, but through fundamentally different approaches: sharding middleware on MySQL versus a ground-up distributed SQL database.

Architecture Differences

Vitess sits between your application and MySQL instances, providing transparent sharding. VTGate handles query routing, VTTablet manages individual MySQL instances, and a topology service (etcd/ZooKeeper) coordinates the cluster. Each shard is a standard MySQL instance, so you retain MySQL's mature query execution.

CockroachDB is a single distributed binary that handles storage, replication, and query execution. Data is automatically split into ranges and distributed across nodes using Raft consensus for replication.

Performance Characteristics

Vitess queries that hit a single shard execute with native MySQL performance. Cross-shard queries require scatter-gather, adding latency. CockroachDB's distributed query planner can push computation to where data lives, but every write involves Raft consensus overhead.

For high-throughput system designs, Vitess's per-shard MySQL performance can be advantageous when access patterns align well with shard keys.

Trade-offs

Vitess's biggest advantage is incremental adoption: you can shard an existing MySQL database without rewriting your application. CockroachDB requires migration from MySQL to a new database system.

CockroachDB's advantage is simplicity at the application layer. No shard key design, no scatter-gather query limitations, and global transactions work across any data. Vitess exposes sharding complexity to developers.

Cross-Shard Transactions

Vitess supports cross-shard transactions via two-phase commit, but they are more expensive and should be minimized. CockroachDB provides serializable distributed transactions natively, making cross-partition operations seamless.

Real-World Usage

Vitess was born at YouTube and runs at Slack, GitHub, and HubSpot. CockroachDB powers DoorDash, Netflix (select services), and Bose. Both handle massive scale but serve different migration paths.

Learn about database sharding and distributed consensus. See our system design guide and pricing.

GO DEEPER

Master this topic in our 12-week cohort

Our Advanced System Design cohort covers this and 11 other deep-dive topics with live sessions, assignments, and expert feedback.