TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

TiDB Lightning Overview

TiDB Lightning is a tool used for importing data at TB scale to TiDB clusters. It is often used for initial data import to TiDB clusters.

TiDB Lightning supports the following file formats:

TiDB Lightning can read data from the following sources:

TiDB Lightning architecture

Architecture of TiDB Lightning tool set

TiDB Lightning supports two import modes, configured by backend. The import mode determines the way data is imported into TiDB.

  • Physical Import Mode: TiDB Lightning first encodes data into key-value pairs and stores them in a local temporary directory, then uploads these key-value pairs to each TiKV node, and finally calls the TiKV Ingest interface to insert data into TiKV's RocksDB. If you need to perform initial import, consider the physical import mode, which has higher import speed. The backend for the physical import mode is local.

  • Logical Import Mode: TiDB Lightning first encodes the data into SQL statements and then runs these SQL statements directly for data import. If the cluster to be imported is in production, or if the target table to be imported already contains data, use the logical import mode. The backend for the logical import mode is tidb.

Import modePhysical Import ModeLogical Import Mode
Backendlocaltidb
SpeedFast (100~500 GiB/hour)Low (10~50 GiB/hour)
Resource consumptionHighLow
Network bandwidth consumptionHighLow
ACID compliance during importNoYes
Target tablesMust be emptyCan contain data
TiDB cluster version>= 4.0.0All
Whether the TiDB cluster can provide service during importLimited serviceYes

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.