Skip to main content
2 of 2
replaced http://dba.stackexchange.com/ with https://dba.stackexchange.com/

If you are using

INSERT INTO mytable (...) VALUES (...), (...), ...;

I would like to suggest one or more of the following

##SUGGESTION #1

Increase your bulk_insert_buffer_size to 128M or 256M.

I have suggested this before.

##SUGGESTION #2

Temporarily disable non-unique indexes before bulk inserts and enable them afterwards.

ALTER TABLE mytable DISABLE KEYS;
INSERT INTO mytable (...) VALUES (...), (...), ...;
ALTER TABLE mytable ENABLE KEYS;

##SUGGESTION #3 (OPTIONAL)

If you do any deletes, then set concurrent_insert=2.

I have suggested this before.

RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531