MySQL: high CPU usage

Nine times out of ten this is down to a table that hasn’t been indexed properly.

Use 

SHOW PROCESSLIST;

to see your MySQL processes. Check out the ‘time’ column.

To add an index use:

ALTER TABLE table ADD INDEX product_id (product_id)

http://stackoverflow.com/questions/3002605/how-to-add-indexes-to-mysql-tables

and

http://dev.mysql.com/doc/refman/5.0/en/create-index.html

Leave a Reply

Your email address will not be published. Required fields are marked *