pingcap/tidb
TiDB
TiDB is an open-source, distributed SQL database written in Go. It speaks the MySQL 8.0 wire protocol, stores data in a horizontally scalable key-value layer (TiKV) with Raft replication, and supports both transactional (OLTP) and analytical (HTAP via TiFlash) workloads from the same data.
This repository (github.com/pingcap/tidb) contains the TiDB SQL layer: the parser, planner/optimizer, execution engine, schema and DDL machinery, session and protocol handling, statistics, and the storage client that talks to TiKV/PD. It also hosts several first-party CLI tools that ship alongside the database server: BR (backup & restore), Lightning (bulk data import), and Dumpling (logical export).
What this repo contains
cmd/tidb-server/— the TiDB SQL server entry point (main.go).pkg/— the bulk of the database. Parser, planner, executor, expression engine, DDL, infoschema, sessions, statistics, storage client, server (MySQL protocol), domain (metadata cache and lifecycle), and a largeutil/tree.br/— Backup & Restore tool and library.lightning/— TiDB Lightning (high-throughput SQL/CSV import).dumpling/— Dumpling (logical SQL/CSV dump tool).tests/— integration and real-TiKV test harnesses (integrationtest,realtikvtest,clusterintegrationtest,globalkilltest, …).docs/— architecture index, agent runbooks, and design docs.tools/— repo tooling (e.g.,tools/check,tools/tazel,tools/patch-go).
Where to start reading
- New to TiDB → Architecture and the Getting started guide.
- Looking up a SQL- or storage-specific concept → Glossary.
- About to contribute → How to contribute and Patterns and conventions.
- Looking for a subsystem → see the Systems index and the source-of-truth
docs/agents/architecture-index.mdin the repo.
Where TiDB fits
A TiDB cluster has three core components:
- TiDB server (this repo): stateless SQL frontend.
- TiKV: distributed transactional KV store (separate repo:
tikv/tikv). - PD (Placement Driver): cluster metadata, region/leader scheduling, timestamp oracle (separate repo:
tikv/pd).
Optionally, TiFlash provides a columnar replica for HTAP workloads. The TiDB server in this repo connects to TiKV and PD through the tikv/client-go/v2 Go client (see pkg/store/driver/), and to TiFlash through MPP coprocessor RPCs (see pkg/store/copr/).
License and project home
- License: Apache 2.0 (
LICENSE). - Documentation: https://docs.pingcap.com/tidb/stable.
- Issues and PRs: https://github.com/pingcap/tidb.
- Contributor guide: https://pingcap.github.io/tidb-dev-guide/.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.