MySQL disable & enable keys

后端 未结 2 1309
野的像风
野的像风 2020-12-02 13:40

In my MySQL database, there is a table which has 2,000,000 records. Now, I would like to insert another 6,000,000 new records into this table.

To speed up the inser

2条回答
  •  忘掉有多难
    2020-12-02 14:06

    Indexing the new keys will take up some time. It's up to you to decide if you want it to be done all at once (disabling it first) or one at a time (by keeping it as-is and letting it index as each record is being added)

    I'd go for the latter, not disabling your keys. If you fear stressing the server to much, you could try inserting in batches, e.g. only a certain amount of inserts per minute.

提交回复
热议问题