Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql duration and fetch time

I am using MySQL workbench - What is the difference between duration and fetch times when a query is run?

Also is there a way I can enable the microsecond option in MySQL?

like image 342
user1189851 Avatar asked Feb 24 '12 03:02

user1189851


People also ask

What is duration and fetch in MySQL?

Duration shows the time needed to execute the query and fetch is the time needed to read the result set (retrieve the data)

What is Fetch time in MySQL workbench?

In MySQL Workbench's Duration / Fetch Time columns, the duration stays consistently under 1ms, regardless of the number of rows selected. However, the fetch time is proportional to rows returned: ~0.5 sec for 1M and and 5.0 sec for 10M rows.

What is Fetch time in SQL?

The "fetch time" is the difference between when the first row is available to the client and the last row has been retrieved by the client.


2 Answers

Fetch time - measures how long transferring fetched results take, which has nothing to do with query execution. I would not consider it as sql query debugging/optimization option since fetch time depends on network connection, which itself does not have anything to do with query optimization. If fetch time is bottleneck then more likely there's some networking problem.

Note: fetch time may vary on each query execution.

Duration time - is the time that query needs to be executed. You should try to minimize it when optimizing performance of sql query.

Reference

like image 168
Leri Avatar answered Sep 20 '22 10:09

Leri


Duration shows the time needed to execute the query and fetch is the time needed to read the result set (retrieve the data)

I am unsure about the microsecond option. If this is in regards to optimization, remember - "premature optimization is the root of all evil"

like image 25
Kurt Avatar answered Sep 17 '22 10:09

Kurt