I have a MySQL database on a shared webhost, which has been running with its application for a couple years.
Today, this simple query:
SELECT COUNT(*) FROM tickets WHERE id = 123
Took 16 seconds to run. There is an index on id, the table is MyISAM, and this query usually takes milliseconds. The table has about 1 million rows, and the query should return a COUNT of about 250,000.
SHOW PROCESSLIST
shows that all the time is being spent Sending data
. I don't have root access, so no profiling help.
I have the same database on another server from the same host, and the query executes in 0.06 seconds.
The host thinks everything is running normally on the server. Is there anything I can point them at?
mysql> EXPLAIN SELECT COUNT(*) FROM tickets WHERE id = 214; | 1 | SIMPLE | tickets | ref | id | id | 2 | const | 215307 | Using index |