Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where to find a history of queries executed by mysql?

Status
Not open for further replies.

philipina

Programmer
Aug 2, 2004
4
LU
Hello,

I have a problem with one application I have written and I think you can help me to find the solution. My problem is that once my application is running for some hours (sometimes 20 hours, sometimes 250 hours) the CPU used by mysql is 99%. In this case the PC and the application is for sure very slow.
I cannot reproduce this problem on my machine but I imagine that somewhere (for some reason) my application is bombing mysql with a lot of queries.
I now have to find which query is it to find where do I have this query in my code and try to unsderstand where is the problem.
My question is the following:
Is there any way to get an history of all queries executed by mysql where we can see the time of each query?

Any other ideas are welcome.

Thanks in advance for your help.

Alain.
 
add these to your my.cnf,
log-slow-queries
long-query-time = 5


set the long-query-time to a value above which you think would be a long query.
and then use mysqldumpslow /var/lib/mysql/servername-slow.log

not sure what the windows equivalent path is, but mysqldumpslow should be available.


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top