Quantcast
Viewing all articles
Browse latest Browse all 3724

Duration vs. Fetch (1 reply)

What is the difference between Duration and Fetch in my Workbench Action Output pane? Can I use it to determine if one query is faster than another?

I ask because I have a query that will typically display a Duration/Fetch of "0.043 sec / 0.000 sec". A slightly modified version of the query changes the actual time it takes for the output window to appear from .1 seconds (I'm guessing) to 1 second or more. BUT ... the Duration/Fetch doesn't change. It will still show around "0.043 sec / 0.000 sec".

Something is slowed down. I'm just curious whether I should be expecting the Duration/Fetch to reflect the delay. The actual queries are below, if you want to see them.

"Slow" version of the query:
select distinct user.id from user 
where user.id not in (select distinct user_id from call_log where dt_created > '2012-07-26')

"Fast" version:
select distinct user.id from user, call_log 
where user.id not in (select distinct user_id from call_log where dt_created > '2012-07-26')

The difference (as you can see) is that I added the table in the sub-query to the list of tables in the main query -- even though nothing from that table is returned.

(I know using a "NOT IN" is bad sql, but I haven't found a better formula. I want all users who EITHER don't have a record in the second table, or that record is "old".)

Viewing all articles
Browse latest Browse all 3724

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>