TiDB Featured Image - Distributed SQL nodes

Top 10 Must-Know Facts About TiDB for Beginners

TiDB Featured Image

In the modern world of software development, data is growing at an unprecedented rate. Traditional databases that worked perfectly on a single server often struggle when faced with millions of concurrent users or petabytes of data. This is where TiDB (Titanium Database) enters the scene.

As a learner, TiDB is a fascinating window into the world of Distributed SQL. It offers the familiarity of MySQL with the horizontal scalability that was previously exclusive to NoSQL systems. In this post, we’ll explore ten essential things you need to know about TiDB and how it compares to other giants like MySQL, PostgreSQL, and CockroachDB.


1. What is TiDB? The ‘NewSQL’ Revolution

Traditionally, you had to choose: the reliable, structured world of SQL or the massive, flexible scale of NoSQL. “NewSQL” is a category that refuses to compromise. TiDB is a lead player in this revolution, providing a relational database that scales like a distributed system while maintaining strict ACID compliance.

2. MySQL Compatibility: Feel at Home

One of the biggest hurdles in adopting a new database is learning a new syntax or rewriting your code. TiDB solves this by being wire-compatible with MySQL. You can use your favorite MySQL drivers, ORMs (like Sequelize, TypeORM, or GORM), and even management tools like MySQL Workbench. For a learner, this means if you know MySQL, you already “know” how to talk to TiDB.

3. Horizontal Scalability: Scaling to Infinity

In a traditional database, if you run out of space, you “scale up” by buying a bigger server. Eventually, you hit a ceiling. TiDB allows you to scale out. Need more storage? Add a storage node. Need more processing power? Add a computing node. The database automatically balances the data for you—no manual sharding required.

4. HTAP: The Best of Both Worlds

Typically, businesses use one database for transactions (OLTP) and another for analytics (OLAP), often moving data between them via complex ETL pipelines. TiDB introduces HTAP (Hybrid Transactional/Analytical Processing). It contains two storage engines: one for rows (fast writes) and one for columns (fast reads). You can run complex reports on live data without slowing down your users’ transactions.

TiDB HTAP Image

5. The Architecture: Who Does What?

TiDB isn’t a single “monolith.” It’s composed of three main parts:

  • TiDB Server: The stateless SQL layer that handles your queries.
  • TiKV: The distributed transactional key-value store where your data actually lives (row-based).
  • PD (Placement Driver): The “brain” of the cluster that manages metadata and keeps everything in balance.

TiDB Architecture Image

(Optional: TiFlash provides the columnar storage for the HTAP magic.)

6. High Availability: Sleep Better at Night

In a distributed system, servers will fail. TiDB uses the Raft consensus algorithm to replicate data across multiple nodes. If one server goes down, the system automatically elects a new leader and keeps serving data. As a developer, you don’t have to write complex retry logic or worry about manual failovers.

7. Separating Compute and Storage

Because the SQL layer (TiDB) is separate from the storage layer (TiKV), you can scale them independently. If your application has complex queries but not much data, you scale TiDB. If you have massive amounts of data but simple queries, you scale TiKV. This efficiency is a core principle of modern cloud-native design.

8. Strong Consistency: No Compromises

Many distributed databases offer “eventual consistency,” meaning data might be slightly out of date for a moment. TiDB provides strong consistency. When you write a piece of data, it is guaranteed to be there for the next read across the entire cluster. This is critical for financial applications or any system where accuracy is non-negotiable.

9. Real-World Use Cases

TiDB is used by companies like Pinterest, Shopee, and many financial institutions. It excels in:

  • E-commerce: Handling massive peak traffic during sales.
  • Finance: Managing high-concurrency transactions with 100% accuracy.
  • Gaming: Scaling player data globally with low latency.

10. The Learning Path

Starting with TiDB is easy. You can run a local cluster in a single command using tiup, look at their excellent open-source documentation, or explore the TiDB Cloud (which offers a free tier). For a learner, the best way to start is to build a simple app using a MySQL driver and see how it behaves when you add more data.


TiDB vs. The World: A Quick Comparison

How does TiDB stack up against the databases you might already know?

Feature MySQL PostgreSQL CockroachDB TiDB
Type Single-node / Primary-Replica Single-node / Primary-Replica Distributed SQL Distributed SQL
Scalability Vertical (Sharding is hard) Vertical (Sharding is hard) Horizontal Horizontal
Protocol MySQL PostgreSQL PostgreSQL MySQL
Native HTAP No No Limited Yes (TiFlash)
Complexity Low Low-Medium Medium-High Medium-High

Summary for Learners:

  • Choose MySQL if you’re building a small-to-medium app and want the simplest setup.
  • Choose PostgreSQL if you need advanced data types, GIS features, or complex relational features.
  • Choose CockroachDB if you are already in the Postgres ecosystem and need massive, global horizontal scale.
  • Choose TiDB if you are in the MySQL ecosystem and need horizontal scale or want to perform real-time analytics on your live data.

TiDB bridges the gap between the database world we know and the massive-scale future we are building. Happy coding!

Lê Hoàng Tâm (Tom Le) is a Software Engineer and Cloud Architect with over 10 years of experience. AWS Certified. Specializes in distributed systems, DevOps, and AI/ML integration. Founder of Th?nk And Grow — a platform sharing practical technology insights in Vietnamese. Passionate about building scalable systems and helping developers grow through real-world knowledge.