The method of high efficiency derivative data is explained by mysql

  • 2020-06-01 11:08:41
  • OfStack

Data: 1 db, 2000 tables, 2000 table data, 30 column records per table, 4.3w records per table, a total of 86388,670 records.

Machine: linux 64bit 8G memory 4 core IntelX3320@2.5GHz

Basic idea:

mysql -utest -pxxxx -s -e "source xxxx.sql" 


Put the load statement in xxxx.sql

load grammar:

load data  [low_priority] [local] infile 'file_name.txt' [replace | ignore]

If the serial import of data will be slow, consider parallel, but there may be conflicts, resolution:

Empty the table before load

truncate table xxxx  or  delete from table xxxx;

Or use the replace or ignore keywords.

Related articles: