I'm not sure why, but the MYSQL gives a very big load on cpu. I have to update the database multiple times per second and the user base is growing.
It was fine at first, but CPU load increased every day and now
Here is the slow query from log:
*Query_time: 4.182654 Lock_time: 0.000070 Rows_sent: 0 Rows_examined: 0
SET timestamp=1315908025;
UPDATE Stats SET Time = 1315908020 WHERE Domain = 'facebook.com';*
why would such a query be so slow? Does slow queries take more CPU?
Could this be because I have chosen the wrong types for rows?
time: int (11), Domain VARCHAR (1000)
开发者_高级运维Stats table have 13k rows and growing.
The most common reason for slow queries is the lack of an index. MySQL has to find the row WHERE Domain='facebook.com'
. Is that a table scan, or an index lookup?
精彩评论