Databases 22 min read

Understanding NewSQL and TiDB: Architecture, Features, and Comparison with Traditional Databases

TiDB, an open‑source NewSQL distributed database, combines the strong consistency and ACID guarantees of traditional relational databases with the scalability of NoSQL, offering cloud‑native architecture, HTAP capabilities, high availability, and seamless MySQL compatibility, while highlighting NewSQL concepts, design trade‑offs, and migration scenarios.

Selected Java Interview Questions
Selected Java Interview Questions
Selected Java Interview Questions
Understanding NewSQL and TiDB: Architecture, Features, and Comparison with Traditional Databases

TiDB is an open‑source NewSQL distributed relational database created by PingCAP. It integrates the strong consistency and ACID transaction guarantees of traditional relational databases with the horizontal scalability of NoSQL, providing a cloud‑native solution that supports both OLTP and OLAP workloads.

NewSQL is defined as the third generation of database systems, positioned between traditional SQL databases (e.g., MySQL) and NoSQL solutions (e.g., MongoDB, Redis). It addresses the performance and scalability bottlenecks of monolithic relational databases in large‑scale, 24/7 internet services.

Traditional SQL databases face two main remedies: upgrading hardware, which eventually hits a ceiling, and sharding data across multiple servers, which introduces complexity such as cross‑shard joins and distributed transactions.

NoSQL solutions sacrifice strong transactional guarantees and relational modeling to achieve high availability and easy scaling. Their advantages include automatic partitioning, high performance, and flexible schemas, while drawbacks involve lack of strong consistency, limited SQL support, and missing relational features.

NewSQL retains the relational model and SQL language while delivering NoSQL‑level scalability. It supports complex queries, ACID transactions, elastic scaling, automatic failover, and cloud‑native deployment, making it suitable for high‑availability, strong‑consistency, and large‑scale applications.

TiDB exemplifies NewSQL. It is compatible with the MySQL 5.7 protocol, allowing most MySQL clients and tools to connect without code changes. TiDB’s architecture consists of three core components: TiDB Server (stateless SQL processing), Placement Driver (PD) for metadata management and scheduling, and TiKV Server (distributed transactional key‑value storage). Additional components such as TiFlash (column‑store for analytical queries) and TiSpark (Spark integration for big‑data analytics) enable HTAP capabilities.

Horizontal elasticity is achieved by simply adding new TiDB or TiKV nodes; the system automatically balances load and replicates data using Raft consensus. PD maintains global metadata, schedules region placement, and assigns monotonically increasing transaction IDs. TiKV stores data in regions (key‑range slices) with multiple replicas, using Raft for consistency and PD for load balancing.

High availability is built into all components. TiDB servers are stateless and can be load‑balanced; PD runs a Raft cluster (recommended three nodes) to survive leader loss; TiKV maintains three replicas per region, automatically re‑replicating data when a node fails.

Typical application scenarios include:

MySQL sharding and consolidation: TiDB can act as a MySQL slave to synchronize data from existing MySQL clusters, enabling real‑time cross‑shard queries.

Direct MySQL replacement: workloads that originally used a single MySQL instance can migrate to TiDB without manual sharding, benefiting from automatic scaling and strong consistency.

Data warehousing and HTAP: TiDB supports analytical queries natively and, when needed, leverages TiSpark for large‑scale Spark‑based analysis.

Component of larger systems: TiKV can serve as a distributed key‑value store or even replace HBase, while TiDB can expose raw APIs for specialized use cases.

Compatibility notes: TiDB fully supports MySQL 5.7 syntax and most MySQL tools, but it does not implement certain features such as stored procedures, triggers, events, custom functions, foreign keys, temporary tables, full‑text/ spatial indexes, and some system schemas. Certain MySQL syntax is parsed but ignored (e.g., ENGINE clause).

Default configuration differences include character set (TiDB defaults to utf8mb4 with utf8mb4_bin collation) and case‑sensitivity settings ( lower_case_table_names=2 is the only supported value). TiDB also enforces tidb_allow_remove_auto_inc=ON for auto‑increment column removal and explicit_defaults_for_timestamp=ON for timestamp handling.

Overall, TiDB demonstrates how NewSQL can provide the best of both worlds—strong relational guarantees and modern distributed scalability—making it a compelling choice for modern cloud‑native applications.

cloud-nativeDistributed 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.