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

前端 未结 5 1034
忘掉有多难
忘掉有多难 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:27

    InnoDB performance is heavily dependent on RAM. If the indexes don't fit in RAM, performance can drop considerably and quickly. Rebuild the whole table improves performance because the data and indexes are now optimized.

    If you are only ever inserting into the table, MyISAM is better suited for that. You won't have locking issues if only appending, since the record is added to the end of the file. MyISAM will also allow you to use MERGE tables, which are really nice for taking parts of the data offline or archiving without having to do exports and/or deletes.

提交回复
热议问题