# `TiDB Lightning` Import Mode

![`smart`](../diagram/LightningLogicalImport2013_aa_001_20230406.png)

![`smart`](../diagram/LightningPhysicalImport2013_aa_001_20230406.png)
------------------------------------------------------------
TiDB Lightning supports two import modes, configured by backend. The import mode determines the way data is imported into TiDB.

Physical import mode is an efficient and fast import mode that inserts data directly into TiKV nodes as key-value pairs without going through the SQL interface. It is suitable for importing up to 100 TB of data. During 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 physical import mode, which has higher import speed.

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 logical import mode.

The preceding performance data on the slide is used to compare the import performance difference between the two modes. The actual import speed is affected by various factors such as hardware configuration, table schema, and the number of indexes.
