# Using TiDB Lightning - Parallel Importing

__*Using Lightning*__
__*Lightning parallel import*__
__*Lightning sharded table shard library merge*__

![left](./student-guide/diagram/TiDBLightningParallel1_aa_001_20220617.png)

-------------------------------------------------------------
TiDB Lightning's Physical Import Mode back-end mode supports parallel import of single or multi-table data starting in v5.3.0. By supporting the simultaneous launch of multiple instances and the parallel import of different data from different single or multiple tables, TiDB Lightning has the ability to scale horizontally, which can greatly reduce the time required to import large amounts of data.
In terms of technical implement, TiDB Lightning coordinates the row ID allocation range of different instances, global checksum records, and configuration changes and recover of TiKV and PD by recording the metadata of each instance and each imported table in the target TiDB.

TiDB Lightning parallel import can be used in the following scenario:
Parallel import database sharding data. In this scenario, multiple tables from multiple upstream DB instances are imported into the downstream TiDB database in parallel by different TiDB Lightning instances.
When using TiDB Lightning to import sharded data in parallel, select the number of TiDB Lightning instances to use according to the amount of data.
If the MySQL data volume is less than 2 TiB, you can use 1 TiDB Lightning instance for parallel import
If the MySQL data volume exceeds 2 TiB, and the total number of MySQL instances is less than 10, it is recommended that each MySQL instance correspond to 1 TiDB Lightning instance, and the number of parallel TiDB Lightning instances should not exceed 10
If the MySQL data volume exceeds 2 TiB, and the total number of MySQL instances exceeds 10, it is recommended that the data exported by these MySQL instances be evenly distributed between 5 to 10 TiDB Lightning instances for import