How to improve the speed of InnoDB writes per second of MySQL DB

前端 未结 4 599
再見小時候
再見小時候 2020-12-16 07:16

On my server, doing insert records into MySQL DB is very slow. Regarding the Server Status, InnoDB writes per second is around 20.

I am not an expert, just graduated

4条回答
  •  春和景丽
    2020-12-16 07:39

    Some hints:

    • Minimize the number of indexes - there will be less index maintenance. This is obvously a trade-off with SELECT performance.
    • Maximize the number of INSERTs per transaction - the "durability price" will be less (i.e. physical writing to disk can be done in the background while the rest of the transaction is still executing, if the transaction is long enough). One large transaction will usually be faster than many small transaction, but this is obviously contingent on the actual logic you are trying to implement.
    • Move the table to a faster storage, such as SSD. Reads can be cached, but a durable transaction must be physically written to disk, so just caching is not enough.

    Also, it would be helpful if you could show us your exact database structure and the exact INSERT statement you are using.

提交回复
热议问题