How to disable index in innodb

后端 未结 4 1729
小蘑菇
小蘑菇 2020-12-05 17:03

I\'m trying to speed up bulk insert in an InnoDB table by temporary disabling its indexes:

ALTER TABLE mytable DISABLE KEYS;

But it gives

4条回答
  •  被撕碎了的回忆
    2020-12-05 18:10

    to reduce the costs for re-calculating the indexes you should insert the data either using DATA INFILE or using Mysql Multi Row Inserts, like

    INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);

    -> so inserting several rows with one statement.

    How many rows one can insert with one statement depends on the max_allowed_packet mysql setting.

提交回复
热议问题