I wanted to speed up a large insert bulk by disabling keys. So I ran the following command on a MyISAM table:
alter table my_table disable keys;
When I execute show index from answer_2011
, I see a comment of disabled
in all the keys, except for the primary key.
Also, as I'm inserting new rows, I see that my_table.MYI
is being modified.
Is there a way to disable or drop the primary key that does not involves having MySQL create temporary tables?
Best Answer
Unfortunately, no there isn't because
ALTER TABLE ... DISABLE KEYS
disables nonunique indexesIf you have to do a bulk insert, you need to use
LOAD DATA INFILE
along with a larger bulk_insert_buffer_size. Here is why: