MCPcopy
hub / github.com/pingcap/tidb

github.com/pingcap/tidb @v8.5.6 sqlite

repository ↗ · DeepWiki ↗ · release v8.5.6 ↗
54,272 symbols 352,620 edges 3,600 files 23,320 documented · 43%
README

TiDB, a distributed SQL database


License Language Build Status Go Report Card GitHub release

TiDB

TiDB (/’taɪdiːbi:/, "Ti" stands for Titanium) is an open-source, cloud-native, distributed SQL database designed for high availability, horizontal and vertical scalability, strong consistency, and high performance.

Key Features

  • Distributed Transactions: TiDB uses a two-phase commit protocol to ensure ACID compliance, providing strong consistency. Transactions span multiple nodes, and TiDB's distributed nature ensures data correctness even in the presence of network partitions or node failures.

  • Horizontal and Vertical Scalability: TiDB can be scaled horizontally by adding more nodes or vertically by increasing resources of existing nodes, all without downtime. TiDB's architecture separates computing from storage, enabling you to adjust both independently as needed for flexibility and growth.

  • High Availability: Built-in Raft consensus protocol ensures reliability and automated failover. Data is stored in multiple replicas, and transactions are committed only after writing to the majority of replicas, guaranteeing strong consistency and availability, even if some replicas fail. Geographic placement of replicas can be configured for different disaster tolerance levels.

  • Hybrid Transactional/Analytical Processing (HTAP): TiDB provides two storage engines: TiKV, a row-based storage engine, and TiFlash, a columnar storage engine. TiFlash uses the Multi-Raft Learner protocol to replicate data from TiKV in real time, ensuring consistent data between the TiKV row-based storage engine and the TiFlash columnar storage engine. The TiDB Server coordinates query execution across both TiKV and TiFlash to optimize performance.

  • Cloud-Native: TiDB can be deployed in public clouds, on-premises, or natively in Kubernetes. TiDB Operator helps manage TiDB on Kubernetes, automating cluster operations, while TiDB Cloud provides a fully-managed service for easy and economical deployment, allowing users to set up clusters with just a few clicks.

  • MySQL Compatibility: TiDB is compatible with MySQL 8.0, allowing you to use familiar protocols, frameworks and tools. You can migrate applications to TiDB without changing any code, or with minimal modifications. Additionally, TiDB provides a suite of data migration tools to help easily migrate application data into TiDB.

  • Open Source Commitment: Open source is at the core of TiDB's identity. All source code is available on GitHub under the Apache 2.0 license, including enterprise-grade features. TiDB is built with the belief that open source enables transparency, innovation, and collaboration. We actively encourage contributions from the community to help build a vibrant and inclusive ecosystem, reaffirming our commitment to open development and accessibility for everyone.

Quick start

[!Tip]
As part of our commitment to open source, we want to reward all GitHub users. In addition to the free tier, you can get up to $2000 in TiDB Cloud Serverless credits for your open-source contributions - Claim here.

  1. Start a TiDB Cluser

    • On Local Playground. To start a local test cluster, please refer to the TiDB quick start guide.

    • On Kubernetes. TiDB can be easily deployed in a self-managed Kubernetes environment or Kubernetes services on public clouds using TiDB Operator. For more details, please refer to the TiDB on Kubernetes quick start guide.

    • Using TiDB Cloud (Recommended). TiDB Cloud offers a fully managed version of TiDB with a free tier, no credit card required, so you can get a free cluster in seconds and start easily: Sign up for TiDB Cloud.

  2. Learn About TiDB SQL: To explore the SQL capabilities of TiDB, refer to the TiDB SQL documentation.

  3. Use MySQL Driver or ORM to Build an App with TiDB with TiDB.

  4. Explore key features, such as data migration, changefeed, vector search, HTAP, disaster recovery, etc.

Need Help?

Architecture

TiDB architecture

Learn more details about TiDB architecture in our Docs.

Contributing

TiDB is built on a commitment to open source, and we welcome contributions from everyone. Whether you are interested in improving documentation, fixing bugs, or developing new features, we invite you to shape the future of TiDB.

<img alt="Active Contributors of pingcap/tidb - Last 28 days" src="https://next.ossinsight.io/widgets/official/compose-recent-active-contributors/thumbnail.png?repo_id=41986369&limit=30&image_size=auto&color_scheme=light" width="655" height="auto">

License

TiDB is under the Apache 2.0 license. See the LICENSE file for details.

See Also

Acknowledgments

Extension points exported contracts — how you extend this code

StoreMeta (Interface)
StoreMeta is the required interface for a watcher. It is striped from pd.Client. [11 implementers]
br/pkg/conn/util/util.go
PlanBuilderOpt (Interface)
PlanBuilderOpt is used to adjust the plan builder. [10 implementers]
pkg/planner/core/planbuilder.go
TxnFuture (Interface)
TxnFuture is an interface where implementations have a kv.Transaction field and after calling Wait of the TxnFuture, the [11 …
pkg/sessionctx/context.go
MiniTaskExecutor (Interface)
MiniTaskExecutor is the interface for a minimal task executor. exported for testing. [30 implementers]
pkg/disttask/importinto/subtask_executor.go
AnalysisJob (Interface)
AnalysisJob is the interface for the analysis job. [6 implementers]
pkg/statistics/handle/autoanalyze/priorityqueue/job.go
Getter (Interface)
Getter is the interface for the Get method. [70 implementers]
pkg/kv/kv.go
TaskMayPanic (Interface)
TaskMayPanic is a type to remind the developer that need to handle panic in the task. [6 implementers]
pkg/resourcemanager/pool/workerpool/workerpool.go
ResultSetNode (Interface)
ResultSetNode interface has a ResultFields property, represents a Node that returns result set. Implementations include [6 …
pkg/parser/ast/ast.go

Core symbols most depended-on inside this repo

MustExec
called by 32517
pkg/testkit/testkit.go
Equal
called by 14879
pkg/kv/key.go
MustQuery
called by 10894
pkg/testkit/testkit.go
Rows
called by 7865
pkg/testkit/result.go
Check
called by 7698
pkg/domain/schema_validator.go
NewTestKit
called by 4016
pkg/testkit/testkit.go
Session
called by 3797
pkg/testkit/testkit.go
NewFieldType
called by 3696
pkg/types/field_type.go

Shape

Method 25,616
Function 21,464
Struct 5,880
Interface 591
TypeAlias 557
FuncType 128
Class 34
Enum 2

Languages

Go100%
TypeScript1%

Modules by API surface

pkg/expression/builtin_time.go522 symbols
pkg/expression/builtin_string.go323 symbols
pkg/expression/builtin_compare.go299 symbols
pkg/parser/ast/misc.go267 symbols
pkg/planner/core/tests/partition/bench_test.go264 symbols
pkg/sessionctx/variable/session.go261 symbols
pkg/parser/ast/ddl.go227 symbols
pkg/planner/core/physical_plans.go226 symbols
pkg/ddl/executor.go222 symbols
pkg/expression/builtin_cast.go217 symbols
pkg/session/session.go205 symbols
pkg/meta/model/job_args.go205 symbols

Dependencies from manifests, versioned

cloud.google.com/gov0.112.2 · 1×
cloud.google.com/go/compute/metadatav0.3.0 · 1×
cloud.google.com/go/kmsv1.15.8 · 1×
cloud.google.com/go/pubsubv1.37.0 · 1×
cloud.google.com/go/storagev1.39.1 · 1×
filippo.io/edwards25519v1.1.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/azcorev1.12.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/azidentityv1.6.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/internalv1.9.0 · 1×
github.com/Azure/azure-sdk-for-go/sdk/storage/azblobv1.0.0 · 1×
github.com/Azure/go-ntlmsspv0.0.0-2022112819355 · 1×

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add tidb \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact