Databases 21 min read

TiDB Overview: Distributed NewSQL Database, Architecture, Features, and MySQL Compatibility

This article provides a comprehensive introduction to TiDB, a distributed NewSQL database that combines OLTP and OLAP capabilities, explains NewSQL concepts, compares traditional SQL, NoSQL and NewSQL, details TiDB's architecture and core components, highlights its high‑availability and scalability features, and outlines compatibility differences and practical use cases.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
TiDB Overview: Distributed NewSQL Database, Architecture, Features, and MySQL Compatibility

What is NewSQL

NewSQL is a class of modern relational databases that retain the ACID guarantees and SQL interface of traditional RDBMS while offering the horizontal scalability of NoSQL systems.

Problems of Traditional SQL and NoSQL

Traditional relational databases struggle with massive data volumes and 24/7 availability, leading to two common solutions: upgrading hardware (which eventually hits a ceiling) and sharding data across many servers (which introduces complex middleware and cross‑shard transaction challenges).

NoSQL sacrifices strong consistency and relational modeling for high availability and easy scaling, but lacks SQL support and strong transactional guarantees.

NewSQL Characteristics

NewSQL combines the best of both worlds: it provides the same scalability as NoSQL while preserving the relational model, mature SQL query language, and ACID transaction support.

TiDB Origins

TiDB was inspired by Google’s F1/Spanner papers and was created by PingCAP co‑founder Huang Dongxu in 2012 to bring a globally distributed, strongly consistent relational database to the cloud.

TiDB Editions

TiDB is offered as a free Community Edition and a paid Enterprise Edition that adds professional support and advanced security features.

Core Features of TiDB

Horizontal elastic scaling – add or remove nodes to adjust capacity without downtime.

Full‑distributed transaction support with 100% ACID compliance.

Financial‑grade high availability using Raft‑based consensus.

Real‑time HTAP – simultaneous OLTP and OLAP workloads via TiKV (row store) and TiFlash (column store) with TiSpark for large‑scale analytics.

Cloud‑native design – deep integration with Kubernetes and support for public, private, and hybrid clouds.

MySQL 5.7 protocol compatibility – most MySQL clients and tools work out of the box.

TiDB Architecture

The cluster consists of three stateless or stateful components:

TiDB Server : receives SQL, parses it, and coordinates with PD and TiKV; stateless and horizontally scalable.

Placement Driver (PD) : stores metadata, schedules region placement, and assigns global transaction IDs; runs a Raft group for high availability.

TiKV Server : a distributed transactional key‑value store that holds data in Region units replicated via Raft.

Additional components include TiSpark for Spark‑based OLAP queries and TiFlash , a columnar storage engine that syncs data from TiKV in real time.

High‑Availability Mechanisms

All three components tolerate node failures: TiDB servers are load‑balanced, PD forms a Raft quorum (recommended three nodes), and TiKV maintains multiple replicas per region (default three) with automatic leader election and region re‑balancing.

Compatibility and Limitations

TiDB supports most MySQL 5.7 syntax and tools, but it does not implement features such as stored procedures, triggers, events, foreign keys, certain character sets, and some system variables. For example, statements like SELECT ... INTO @var or SELECT ... WITH ROLLUP are not supported.

Default settings differ from MySQL: TiDB uses utf8mb4 with utf8mb4_bin collation, enforces lower_case_table_names=2 , and has explicit_defaults_for_timestamp=ON .

Use Cases

Replacing MySQL sharding solutions – TiDB can act as a single logical database handling cross‑shard queries.

Direct MySQL replacement for growing OLTP workloads requiring strong consistency.

Data warehouse / HTAP scenarios – TiDB 2.0 can run complex analytical queries within seconds, and TiSpark extends this capability.

As a storage engine for other systems – TiKV can serve as a key‑value store or even a Redis‑compatible backend.

Conclusion

TiDB offers a cloud‑native, horizontally scalable, strongly consistent NewSQL solution that bridges the gap between OLTP and OLAP, while maintaining compatibility with the MySQL ecosystem, making it suitable for a wide range of modern data‑intensive applications.

Distributed DatabaseTiDBHTAPNewSQLMySQL Compatibility
Selected Java Interview Questions
Written by

Selected Java Interview Questions

A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.