Portal Home > Knowledgebase > Articles Database > how to get slow mysql queries


how to get slow mysql queries




Posted by jeffroyit, 09-13-2010, 12:29 PM
I have a server that is on the edge of collapsing due to high load on mysql. Since it is an e-commerce site, I am afraid of enabling log mysql queries. What other solution would be to better identify slow queries that put load on the server and need to be optimized? Thank you in advance for any suggestion ...

Posted by matt2kjones, 09-13-2010, 06:31 PM
If your sure that its particular queiries which are taking a long time then you could get the time in miliseconds before and after every sql query on your site, and if its over a particular threshhold then log it to a file. But this involves adding code to your site which may not be a solution to you plus its kind of a dirty hack.

Posted by xerophyte, 09-13-2010, 08:47 PM
slow query log options comes with option to specify time period ..

Posted by jphilipson, 09-14-2010, 02:56 AM
Slow query logging shouldn't add much load to the server. Also, watch the queries in real time using "mysqladmin pr", keeping an eye out for tmp table writes in certain. They cause high disk I/O wait.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Cartika Down ? (Views: 682)
NYNOC down? (Views: 701)

Language: