Is time to deliver data included in time measured for a Slow Query 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?
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.