I've got a problem with with my MySQL database (running on Ubuntu). I tried to run a query on a table (InnoDB) containing 250 thousand rows. The result of the query is only 3 rows. However, it took 4 minutes to get the result.
How to improve the performance?
Open the /etc/my.cnf in the text editor
sudo gedit /etc/my.cnf
Then go to [myslqd] section and add the buffer size.
The default size is 8M. In my case, I increased it to 256M
innodb_buffer_pool_size = 256M
Then restart mysql
sudo /etc/init.d/mysqld restart
To check the change, go to mysql command line and run SHOW VARIABLES.
DONE.
Source:
http://www.cowboycoded.com/2009/08/26/a-quick-performance-tune-for-mysql-innodb_buffer_pool_size/