There's a production database I'm working on, whose 4 largest tables contain between 4 million and 10 million rows each and about 15 fields each, with indexes on different field types (numbers, varchar and text). The total index_length is 2.2GB and the data_length is 6GB. All these tables use MyISAM and they have a read/write ratio of 66/33.

Here's the output from /etc/init.d/mysql status during idle time:

Server version          5.1.37-1ubuntu5
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/run/mysqld/mysqld.sock

Threads: 27  Questions: 5430994  Slow queries: 59  Opens: 298  Flush tables: 1  Open tables: 128  Queries per second avg: 182.695

The number of queries per second is at about 300 during peak time.

In the last couple of weeks, the database has become so slow that sometimes queries are locking for 2+ minutes. So, I increased key_buffer_size to 4GB (I have 8GB on the machine). The lock times have decreased. Yet, it's still unbearable during peak hours, especially when the reads/writes ratio approaches 50/50.

The server is running on a virtual environment so I/O is not great and most of the select queries do a ORDER BY <some_indexed_field> on results sets with an average of 50k rows.

I've successfully tuned this database before when it was still smaller but now I'm stuck.

Update: Disk utilization easily reaches 100% during the day.

1 Answer 1


You have to use InnoDB. Here is why :

The major advantages of InnoDB over MyISAM

MyISAM is great in a read-heavy environment. Although you can configre private caches on a per-table basis, MyISAM never caches data.

InnoDB is your best bet !!!


Get enough RAM on the DB Server to cache everything in the InnoDB Buffer Pool (75% of Installed RAM).

  • 1
    Agreed, especially for the row-level locking which you appear to need in this instance.
    – Dave Rix
    Commented Oct 10, 2011 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.