Why do MySQL InnoDB inserts / updates on large tables get very slow when there are a few indexes?

前端 未结 5 1036
忘掉有多难
忘掉有多难 2020-12-14 02:48

We have a series of tables that have grown organically to several million rows, in production doing an insert or update can take up to two seconds. However if I dump the tab

5条回答
  •  旧巷少年郎
    2020-12-14 03:10

    Updating a table requires indices to be rebuilt. If you are doing bulk inserts, try to do them in one transaction (as the dump and restore does). If the table is write-biased I would think about dropping the indices anyway or let a background job do read-processing of the table (eg by copying it to an indexed one).

提交回复
热议问题