MySQL keeps frequently used data and indexes in memory, in the InnoDB buffer pool. When the pool is too small for the Magento database, MySQL keeps going to disk, and every page that touches the database gets slower. Many servers still run with a buffer pool of 128 MB, the MySQL default, which is far too small for any real store.

Compare the pool with your database

SELECT @@innodb_buffer_pool_size / 1048576 AS pool_mb;

SELECT ROUND(SUM(data_length + index_length) / 1048576) AS db_mb
  FROM information_schema.TABLES WHERE table_schema = DATABASE();

Check how often MySQL goes to disk

SHOW STATUS LIKE 'Innodb_buffer_pool_read%';

Innodb_buffer_pool_reads counts reads from disk, and Innodb_buffer_pool_read_requests counts all reads. On a well-sized server, disk reads are a tiny fraction of requests.

Choose a size

  • Dedicated database server: about 70–80% of RAM.
  • Shared server running MySQL, PHP, Redis and search together: enough to hold your database plus room to grow, while leaving memory for the others.

Set it in /etc/mysql/my.cnf under [mysqld], then restart MySQL in a quiet period:

innodb_buffer_pool_size = 4G

On AWS RDS, change it in the parameter group.

Don’t overdo it

A buffer pool so large that the server starts swapping is worse than one that’s too small. Watch free memory after the change.

Catch it automatically

MageMonitor checks for this every few minutes as part of its Database checks, and alerts you by email, Slack or webhook the moment it appears, with the exact commands to fix it. See MageMonitor for Magento 2.

Related fixes