| Monitoring MySQL Queries [message #1709] |
Fri, 31 August 2007 09:23  |
srynonick Messages: 6 Registered: August 2007 |
Junior Member |
|
|
hello,
are there any tools to monitor which queries have been executed on the mysql server and especially how long they took?
thank you very much!
|
|
|
| Re: Monitoring MySQL Queries [message #1712 is a reply to message #1709 ] |
Sun, 02 September 2007 11:49   |
 |
jcn50 Messages: 44 Registered: September 2007 |
Member |
|
|
Do you have phpMyAdmin?... I'm using it when I want to check the load, SQL command is:
SHOW PROCESSLIST
Hope this helps~.
Enjoy the Net!
|
|
|
|
| Re: Monitoring MySQL Queries [message #1715 is a reply to message #1709 ] |
Sun, 02 September 2007 12:22   |
 |
jcn50 Messages: 44 Registered: September 2007 |
Member |
|
|
You need to turn the LOG feature ON in the mySQL config file (my.ini).
Is your mySQL server on your computer? Or shared hosting?
Enjoy the Net!
|
|
|
| Re: Monitoring MySQL Queries [message #1716 is a reply to message #1709 ] |
Sun, 02 September 2007 12:28   |
 |
jcn50 Messages: 44 Registered: September 2007 |
Member |
|
|
I have a better idea for you: you can measure the time your query took, within your script... just take the time before the query, and after.... and you're done~.
Enjoy the Net!
|
|
|
|
| Re: Monitoring MySQL Queries [message #1718 is a reply to message #1709 ] |
Sun, 02 September 2007 12:36   |
srynonick Messages: 6 Registered: August 2007 |
Junior Member |
|
|
hello,
thank you again for your reply. yes, mysql is running on my local pc, where i'm developing and need the execution times to do some optimations.
i've googled a little bit and activated logging (mysql -l). a log looks like this:
mysqld, Version: 5.0.45-community-nt-log (MySQL Community Edition (GPL)). started with:
TCP Port: 0, Named Pipe: (null)
Time Id Command Argument
070902 18:35:01 1 Connect root@localhost on testdb
1 Query select * from testtab
well, starting time is included and the query, but not how long the query took ):
i also couldn't find something about an additional option for this?
[Updated on: Sun, 02 September 2007 12:36]
|
|
|
| Re: Monitoring MySQL Queries [message #1719 is a reply to message #1709 ] |
Sun, 02 September 2007 12:39   |
 |
jcn50 Messages: 44 Registered: September 2007 |
Member |
|
|
Tell me if the upper code was OK for you.
Enjoy the Net!
|
|
|
| Re: Monitoring MySQL Queries [message #1720 is a reply to message #1709 ] |
Sun, 02 September 2007 15:57  |
srynonick Messages: 6 Registered: August 2007 |
Junior Member |
|
|
sorry, was writing while you posted and didn't see your code!
i know this can be done in php, but using mysql i wouldn't have to change anything in my php script, could also easily analyze other scripts, which aren't written by me.
[Updated on: Sun, 02 September 2007 15:57]
|
|
|