user775013
user775013

Reputation: 83

MYSQL takes 100% of CPU. Slow queries

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.

Upvotes: 0

Views: 664

Answers (1)

MSalters
MSalters

Reputation: 179787

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?

Upvotes: 2

Related Questions