What is TiDB?
TiDB is an open-source distributed SQL database developed by PingCAP. The name "TiDB" comes from "Ti" (Titanium), symbolizing strength and durability. TiDB is designed to support Hybrid Transactional and Analytical Processing (HTAP) workloads.
Key Features of TiDB
- Horizontal Scalability — TiDB supports adding nodes horizontally without downtime. The compute-storage separation architecture decouples the compute layer from data storage.
- MySQL Compatible — TiDB is compatible with the MySQL protocol. Most applications running on MySQL can move to TiDB with no code changes.
- Strong Consistency — TiDB uses the Raft protocol to keep data consistent across all replicas.
- High Availability — Data is stored in at least 3 replicas. If one node fails, the system keeps running without interruption.
- Real-time HTAP — Two storage engines (TiKV for row-based and TiFlash for column-based) enable transactional and analytical queries in a single cluster.
When to Use TiDB?
TiDB is a good fit for scenarios that require:
- Horizontal scalability for large datasets (hundreds of TB up to PB)
- High availability (RPO = 0, RTO ≤ 30 seconds)
- Strong data consistency, as required in the banking industry
- Real-time data analysis without a separate ETL pipeline
- Migration from MySQL without application changes
Comparison with Other Databases
| Feature | MySQL | PostgreSQL | TiDB |
|---|---|---|---|
| Horizontal Scalability | Limited | Limited | Yes |
| Distributed Transactions | No | No | Yes |
| MySQL Compatible | Yes | No | Yes |
| HTAP | No | No | Yes |
| Open Source | Yes | Yes | Yes |
Key Components of TiDB
TiDB consists of several components that work together:
- TiDB Server — the SQL layer that receives queries from applications
- TiKV — the key-value storage engine for transactional data
- TiFlash — the columnar storage engine for analytics
- PD (Placement Driver) — the metadata manager and cluster scheduler
- TiUP — the package manager for deploying and managing TiDB
In the next chapter, we will take a closer look at the TiDB architecture.