Not much detail there (but I'll go off what you provided...). Some people
limit the actual MySQL system for times it TAKES MySQL to execute queries.
For THIS to be accomplished, MySQL has built-in functionality to measure the
time is takes queries to take place so it can ... limit them. So, in
essence, I guess we can extract that data and get it back to you for
whatever usage statistic you are looking to measure. ( See:
or for usage in JDBC by calling the setQueryTimeout() function of a
Statement object...and so forth.
HOWEVER - Just so you know, if you execute the query MANUALLY via the
of MySQL* it will tell you how long the query took. Just use normal SQL
syntax, execute the query on the table and VOILA! Your answer:
run the query (use the below quoted/threaded example as a starting place to
write your own query...?)
Take a look at this thread (it basically explains the answer with a bit more
detail on what the output will be):
> SELECT * FROM user_log;
> 15113 rows fetched in 5.3274s (0.1498s)
> SELECT BENCHMARK(100000000, RAND());
> 1 row fetched in 0.0505s (13.2676s)
> I believe the results are the following:
> The first number is the time it took MySQL server to send the result set
> to the client.
> The second number (in parens) is the time it took MySQL server to execute
> the query itself.
TOTAL TIME will EQUAL A + B (for total time it took on your server/P.C. or
wherever you are running the query...). Many things come into factoring why
it takes longer or shorter. So this is why I asked if you are attempting to
optimize or what not, but that is whole new story.
(( ----> What Operating System are you running? This would be helpful to
give you the step-by-step, so to speak. Or perhaps provide us with a bit
***Also, if you are looking to perhaps make it so queries take shorter times
(optimization effort) to execute a little bit more about your MySQL database
setup and machine(s) would be beneficial to us as well. ))
Let me know if you have any questions.
Standing by and I hope this helped you.
xq on FreeNode #mysql | #apache
On Wed, May 14, 2008 at 6:13 AM, Neil Tompkins <neildtompkins@stripped>
> When performing a SQL query like SELECT Name FROM Customers. How do I
> obtain the time in which the query took to execute like 1.5 seconds etc
> All new Live Search at Live.com