TiDB Overview: Architecture, Features, Compatibility, and Use Cases
This article provides a comprehensive overview of TiDB, an open‑source distributed NewSQL database, covering its origins, architecture components, high‑availability design, HTAP capabilities, MySQL compatibility, differences from traditional SQL and NoSQL, and practical deployment scenarios.
What is TiDB
TiDB is an open‑source distributed NewSQL relational database designed by PingCAP. It supports both OLTP (online transaction processing) and OLAP (online analytical processing) workloads, offering a hybrid HTAP solution that combines strong consistency with horizontal scalability.
Evolution of Database Technologies
Database development has progressed through three generations: traditional SQL databases (e.g., MySQL), NoSQL systems (e.g., MongoDB, Redis), and NewSQL solutions that retain relational models while providing NoSQL‑like scalability.
Traditional SQL suffers from scalability limits, often requiring hardware upgrades or complex sharding. NoSQL offers high availability and horizontal scaling but sacrifices strong consistency and SQL compatibility. NewSQL, exemplified by TiDB, merges the best of both worlds.
TiDB Core Features
SQL support with full MySQL 5.7 protocol compatibility.
ACID‑compliant distributed transactions.
Horizontal elastic scaling of compute and storage.
Financial‑grade high availability via Raft consensus.
Real‑time HTAP using TiKV (row store) and TiFlash (column store) together with TiSpark for large‑scale analytics.
Cloud‑native design tightly integrated with Kubernetes.
TiDB Architecture
The cluster consists of three primary components:
TiDB Server : Stateless SQL processing layer that forwards queries to storage nodes.
Placement Driver (PD) : Cluster metadata manager that schedules regions, balances load, and issues global transaction IDs.
TiKV Server : Distributed transactional key‑value store where data is split into Regions and replicated via Raft.
Additional optional components include TiSpark for Spark‑based analytics and TiFlash for columnar storage acceleration.
High‑Availability Design
All three components (TiDB, PD, TiKV) are deployed as Raft clusters. TiDB is stateless and can be load‑balanced; PD requires an odd number of nodes (recommended three) to maintain quorum; TiKV stores multiple replicas per Region (default three) and automatically recovers from node failures.
Use Cases
MySQL sharding and consolidation : TiDB can act as a MySQL slave to synchronize data, enabling real‑time cross‑shard queries without middleware.
Direct MySQL replacement : Applications can switch to TiDB with minimal code changes, gaining horizontal scalability and strong consistency.
Data warehouse : TiDB 2.0 delivers sub‑10‑second query times on TPC‑H‑style workloads; TiSpark extends analytics to massive datasets.
Component for other systems : TiKV can serve as a drop‑in replacement for HBase or as a backend for Redis‑compatible services.
Compatibility and Limitations
TiDB fully supports the MySQL 5.7 protocol and most client tools, but it does not implement certain MySQL features such as stored procedures, triggers, events, foreign keys, and some advanced SELECT syntax. Configuration defaults differ (e.g., default charset utf8mb4, lower_case_table_names=2, explicit_defaults_for_timestamp=ON).
Conclusion
TiDB offers a cloud‑native, horizontally scalable, strongly consistent NewSQL platform that bridges the gap between traditional relational databases and modern NoSQL systems, making it suitable for high‑traffic OLTP, real‑time OLAP, and hybrid workloads.
Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.