📣
TiDB Cloud Essential is now in public preview. Try it out →

TiDB Best Practices



By following best practices for deploying, configuring, and using TiDB, you can optimize the performance, reliability, and scalability of your TiDB deployments. This document provides an overview of the best practices for using TiDB.

Overview

Get started with basic principles and general recommendations for using TiDB effectively.

Best practice topicDescription
Use TiDBA comprehensive overview of best practices for using TiDB.

Schema design

Learn best practices for designing schemas in TiDB, including managing DDL operations, choosing primary keys, and designing and maintaining indexes to balance performance, scalability, and maintainability.

Best practice topicDescription
Manage DDLBest practices for managing Data Definition Language (DDL) operations in TiDB.
Use UUIDs as Primary KeysBest practices for storing and indexing UUIDs (Universally Unique Identifiers) efficiently when using UUIDs as primary keys.
Optimize Multi-Column IndexesBest practices for designing and using multi-column indexes in TiDB to improve query performance.
Manage Indexes and Identify Unused IndexesBest practices for managing and optimizing indexes, identifying and removing unused indexes in TiDB to optimize performance.

Deployment

Explore recommended deployment patterns for different scenarios, such as deployment on public cloud and multi-data center setups, to ensure high availability and efficient resource usage.

Best practice topicDescription
Deploy TiDB on Public CloudBest practices for deploying TiDB on public cloud to maximize performance, cost efficiency, reliability, and scalability of your TiDB deployment.
Three-Node Hybrid DeploymentBest practices for a cost-effective, hybrid three-node deployment while maintaining stability.
Local Reads in Three-Data-Center DeploymentsBest practices for reducing cross-center latency by using Stale Read.

Operations

Find operational best practices for running TiDB in production, such as traffic routing, load balancing, and monitoring, to ensure system stability and observability.

Best practice topicDescription
Use HAProxy for Load BalancingBest practices for configuring HAProxy to distribute application traffic across multiple TiDB nodes.
Use Read-Only Storage NodesBest practices for using read-only nodes to isolate analytical or heavy read workloads from OLTP traffic.
Monitor TiDB Using GrafanaBest practices for using key metrics and dashboard configurations for proactive troubleshooting.

Performance tuning

Understand how to tune TiDB components such as TiKV and PD, and how to use features like read-only storage nodes to improve performance under different workloads.

Best practice topicDescription
Handle Millions of Tables in SaaS Multi-Tenant ScenariosBest practices for using TiDB in SaaS (Software as a Service) multi-tenant environments, especially in scenarios where the number of tables in a single cluster exceeds one million.
Handle High-Concurrency WritesBest practices for handling high-concurrency write-heavy workloads in TiDB to avoid write hotspots and optimize performance.
Tune TiKV Performance with Massive RegionsBest practices for optimizing TiKV performance and reducing heartbeat overhead when managing millions of Regions.
Tune PD SchedulingBest practices for adjusting PD policies to balance load and speed up failure recovery.

Was this page helpful?