What TiDB Does
- Distributed SQL — horizontal scaling like NoSQL but with SQL and ACID
- MySQL compatible — wire protocol + most MySQL syntax
- HTAP — row-store (TiKV) + column-store (TiFlash) for mixed workloads
- Raft consensus — strong consistency across replicas
- Elastic scale — add nodes without downtime
- Online DDL — schema changes without locks
- Auto-sharding — data automatically partitioned and rebalanced
- Cross-region clusters — geo-distributed deployments
Architecture
Three layers:
- TiDB servers — stateless SQL layer, parse/plan/execute queries
- TiKV — distributed KV store (Rust), uses Raft for replication
- PD (Placement Driver) — cluster metadata and scheduling
- TiFlash (optional) — columnar replica for analytics
Self-Hosting
# Production deployment
tiup cluster deploy mycluster v7.5.0 topology.yaml
tiup cluster start mycluster
tiup cluster display mycluster
# Scale out
tiup cluster scale-out mycluster scale.yamlKey Features
- MySQL 5.7/8.0 compatibility
- Distributed SQL with ACID
- HTAP (TiFlash columnar)
- Elastic horizontal scaling
- Online DDL
- Point-in-time recovery
- Encryption at rest
- Cloud-ready (TiDB Cloud managed service)
- PingCAP official tools ecosystem
Comparison
| Database | Model | SQL Standard | Scaling |
|---|---|---|---|
| TiDB | Distributed SQL | MySQL-compatible | Horizontal |
| CockroachDB | Distributed SQL | PostgreSQL-compatible | Horizontal |
| YugabyteDB | Distributed SQL | PostgreSQL-compatible | Horizontal |
| Spanner | Distributed SQL | Managed | Managed |
| Vitess | MySQL sharding | MySQL | Horizontal |
| MySQL Group Replication | HA cluster | MySQL | Vertical + replicas |
FAQ
Q: Can it replace MySQL? A: Yes in most scenarios, with 95%+ compatibility. But some MySQL features (like event scheduler or specifying storage engines) are not supported. Do a compatibility test before migrating.
Q: What is TiFlash? A: A columnar replica that syncs TiKV data to columnar storage to accelerate analytical queries. A single table can have both row storage (OLTP) and column storage (OLAP).
Q: Minimum production deployment? A: 3 PD + 3 TiKV + 2 TiDB = 8 nodes. TiFlash is optional. TiDB Cloud has a minimum of 3 nodes.
Sources
- Docs: https://docs.pingcap.com/tidb
- GitHub: https://github.com/pingcap/tidb
- License: Apache 2.0