# The Principle of TiDB Lightning

__*The Lightning Principle*__
__*Lightning architecture*__

![left](./student-guide/diagram/TiDBLightningPI5_en_001_20220617.png)
-------------------------------------------------------------
After all the engine files associated with the entire table are imported, tidb-lightning compares the checksum (checksum) of the local data source and the downstream cluster to ensure that the imported data is intact, and then TiDB analyzes the newly added data to optimize future operations. Also, tidb-lightning adjusts the AUTO_INCREMENT value to prevent conflicts when data is added later.

The auto increment ID for a table is derived from the upper bound estimate of the number of rows, which is proportional to the total size of the table's data file. As a result, the final self-incrementing ID is usually much larger than the actual number of rows. This is normal because self-incrementing IDs are not necessarily assigned continuously in TiDB.