Insertion speed slowdown as the table grows in mysql

前端 未结 3 1801
天涯浪人
天涯浪人 2021-02-04 17:33

I am trying to get a better understanding about insertion speed and performance patterns in mysql for a custom product. I have two tables to which I keep appending new rows. The

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 18:04

    Edit your /etc/mysql/my.cnf file and make sure you allocate enough memory to the InnoDB buffer pool. If this is a dedicated sever, you could probably use up to 80% of your system memory.

    # Provide a buffer pool for InnoDB - up to 80% of memory for a dedicated database server
    innodb_buffer_pool_size=614M
    

    The primary keys are B Trees so inserts will always take O(logN) time and once you run out of cache, they will start swapping like mad. When this happens, you will probably want to partition the data to keep your insertion speed up. See http://dev.mysql.com/doc/refman/5.1/en/partitioning.html for more info on partitioning.

    Good luck!

提交回复
热议问题