Skip to content
TiDB logo

TiDB

PingCAP's MySQL-compatible distributed SQL database, Apache 2.0 across TiDB, TiKV and TiFlash. Vector columns and HNSW indexes ride on the TiFlash columnar replica, next to transactional rows.

3/5 my assessment
Open-source
SoftwareArtificial Intelligence

Overview

PingCAP started TiDB in Beijing in 2015 and it has become the reference open-source distributed SQL database out of China, licensed Apache 2.0 across the whole self-managed stack: the TiDB SQL layer, the TiKV row store, the TiFlash columnar engine and the PD scheduler. The design goal was MySQL compatibility with horizontal scale and ACID guarantees, and that remains the reason most teams pick it up. Vector search arrived later, reaching self-managed clusters in v8.4.0 and stabilising in the v8.5 line.

The implementation is deliberate rather than ambitious. A VECTOR column holds up to 16383 dimensions, the HNSW index lives in TiFlash, and the two supported distance functions are VEC_COSINE_DISTANCE() and VEC_L2_DISTANCE(). If a vector index is declared at table creation TiDB provisions the TiFlash replica automatically. If not, you add the replica before you can add the index. That constraint is the whole trade: you are running columnar nodes to get ANN search, which is efficient if you already wanted TiFlash for analytics and expensive if you did not. There is no inner product distance, no sparse vector support and no BM25 scoring, so hybrid ranking is your application's job.

Where this earns its place is state that must be transactional. Agent memory, session context, user-scoped retrieval and anything where a stale or partially committed embedding causes a correctness bug rather than a slightly worse result. The row and its vector commit together. On the practical side, PingCAP's English documentation at docs.pingcap.com is the best in this whole category and needs no Mandarin, images and binaries are freely available, and self-managed deployment needs no mainland phone number or business licence. TiDB Cloud is billed in USD by card. Check your replication path before committing: TiCDC may convert vector data when replicating to systems without vector support, TiDB DM will not replicate vector types from MySQL, and BR must be v8.4.0 or later to back them up.

Key Features

  • VECTOR data type supporting up to 16383 dimensions, with VEC_COSINE_DISTANCE() and VEC_L2_DISTANCE() as the two distance functions available for ANN queries
  • HNSW vector index that requires a TiFlash columnar replica on the table. Define the index at CREATE TABLE and TiDB provisions the replica for you, otherwise you add the replica manually first
  • Vector search on self-managed clusters requires TiDB v8.4.0 or later, with v8.5 recommended. The 8.5 line is actively patched: 8.5.5 in January 2026, 8.5.6 in April, 8.5.7 in July and 8.5.8 on 27 August 2026
  • MySQL 8.0 wire protocol with full ACID transactions in the same engine as the vector search, so embeddings and the rows they describe commit together with no dual-write
  • HTAP by design: TiKV holds the row store, TiFlash holds the columnar replica, and the optimiser routes across both, which is what makes analytics and ANN coexist
  • TiDB X, announced October 2025, rebuilds storage on object storage to decouple compute from storage for elastic scaling

Where it holds

  • Apache 2.0 across the entire self-managed stack with no open-core carve-out on the database itself, which is rarer than it should be in distributed SQL
  • The best English documentation of any Chinese database project. PingCAP has written for an international audience since 2017 and it shows in the reference material
  • MySQL compatibility means existing ORMs, migrations, connection pools and BI tools work unchanged, which shortens adoption to hours rather than weeks
  • One system covers transactions, analytics and vector retrieval, reducing the number of moving parts an on-call engineer has to understand

Where it breaks

  • Vector search is documented as public preview and subject to change. Build against it knowing the API may drift between minor versions
  • The TiFlash replica requirement is a real cost. Provisioning columnar nodes purely to get ANN indexing is heavy if vectors are the only reason you need them
  • Only cosine and L2 distance are supported. No inner product, no sparse vectors and no BM25 hybrid scoring inside the engine, so hybrid ranking happens in your application
  • Ecosystem tooling lags the feature: TiCDC may convert vector data when replicating downstream, TiDB DM does not replicate vector types from MySQL, and backup needs BR v8.4.0 or later

My Take

The vector layer here is a bolt-on and it helps to say so before anything else. Vector columns cap at 16383 dimensions, the HNSW index only exists on tables carrying a TiFlash columnar replica, only cosine and L2 distance are available, and the feature is still marked public preview in the 8.5 documentation. What you get in exchange is an Apache 2.0 distributed SQL database speaking MySQL 8.0 that commits an embedding in the same transaction as the row it describes, which for agent memory or session state is worth more than raw recall numbers. PingCAP's English documentation is the strongest in Chinese open-source infrastructure, and the 8.5 line is genuinely maintained, with 8.5.8 shipping on 27 August 2026.

Francis Okafor
Francis Okafor AI & Tech Lead · Engineer

Quick Info

Pricing:
open-source
Openness:
Open source
Licence:
Apache 2.0
Starting at:
TiDB Self-Managed is Apache 2.0 and free, covering TiDB, TiKV, TiFlash and PD, with no feature gating in the open-source build. Costs are nodes: a vector index means running TiFlash columnar replicas in addition to the TiKV row store. TiDB Cloud is the paid managed option, with a free Starter tier that also carries vector search, and it is billed in USD by card.
Added:
Aug 2026
Updated:
Aug 2026

Use Cases

agent development knowledge management software development enterprise ai

Judge it on your own work

The notes above say where TiDB holds and where it breaks. The fastest check is your own workload.

Visit website ↗

Alternatives to TiDB