Forum Moderators: open

Message Too Old, No Replies

Help: How to find MySQL query log?

         

ozzyman

2:20 pm on Dec 7, 2005 (gmt 0)

10+ Year Member



I have huge load on my site because of mysql database queries.
I did necessary indexes and make some optimisations on data values. Now I'm tryin "EXPLAIN SELECT" query to find slow queries.
But if I get a query log with query times that will be a shortcut to find the problem.
Has mysql got a query log and where can I find it?
Do you recommend a tool or script to log mysql queries?
If I can see on the server that would be so helpful. But I can try on my windows localhost too.

physics

9:44 pm on Dec 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi. There is a MySQL slow query log, but you have to turn it on either at run time with a switch or by adding a line to my.cnf
[dev.mysql.com...]

Another useful tool is mytop


mytop is a Perl program which allows you to monitor MySQL servers by viewing active threads, queries and overall server performance numbers.

[freshmeat.net...]

FalseDawn

6:22 am on Dec 9, 2005 (gmt 0)

10+ Year Member



If you are using database wrapper funtions, it's also relatively easy to use timing functions (eg PHP's microtime) to time each query's execution and store (eg) the query string and execution time in a log table.