Skip to main content
replaced http://dba.stackexchange.com/ with https://dba.stackexchange.com/
Source Link

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 beforeI 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 beforeI have suggested this before.

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.

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.

Source Link
RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531

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.