|
8.5.4 Bulk Data Loading for InnoDB Tables
1)When importing data into InnoDB, turn off autocommit mode
2)If you have UNIQUE constraints on secondary keys, you can speed up table imports by temporarily turning off the uniqueness checks during the import session
3)If you have FOREIGN KEY constraints in your tables, you can speed up table imports by turning off the foreign key checks for the duration of the import session
4)Use the multiple-row INSERT syntax to reduce communication overhead between the client and the server if you need to insert many rows:
5)When doing bulk inserts into tables with auto-increment columns, set innodb_autoinc_lock_mode to 2 instead of the default value 1
8.2.2.1 Speed of INSERT Statements
1)If you are adding data to a nonempty table, you can tune the bulk_insert_buffer_size variable to make data insertion even faster
2)When loading a table from a text file, use LOAD DATA INFILE. This is usually 20 times faster than using INSERT statements.
|
|