Instantly share code, notes, and snippets.

Embed
What would you like to do?
MySQL fast data load
#1
LOAD DATA INFILE...
#2
ALTER TABLE name DISABLE KEYS; // tells MySQL to stop updating nonunique indexes
INSERT ...
...
ALTER TABLE name ENABLE KEYS; // re-creates missing indexes (much faster than inserting one by one)
#3 (InnoDB)
BEGIN;
INSERT ...
...
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment