Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm looking at some horrible numbers in a SLOW_QUERY_LOG (one example)

Count: 2563 Time=23.21s (59498s) Lock=0.00s (1s) Rows=21.4 (54857)

This is for a simple SELECT statement that runs for less than a second when I try to run it manually.

The database services a java/tomcat application that I know have some problems.

My question:

Is it possible for the calling application to cause these abnormal numbers in the database? For example by asking the database for some data and then taking it's sweet long time to accept it?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

It is absolutely possible the application taking a long time can cause those numbers. From the slow query manual (emphasis mine):

mysqld writes a statement to the slow query log after it has been executed and after all locks have been released

So if your application is taking a long time to release any lock that it acquired for the session, the query time written will reflect that.

Now in your specific scenario, is it possible that the slow execution times are occurring during some heavy load on your database server? That would cause abnormal query times irregardless of slow lock release.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.