Re: Difference between "Explain analyze" and "\timing" - Mailing list pgsql-performance

From Tom Lane
Subject Re: Difference between "Explain analyze" and "\timing"
Date
Msg-id 26508.1217466398@sss.pgh.pa.us
Whole thread Raw
In response to Re: Difference between "Explain analyze" and "\timing"  (Bill Moran <wmoran@collaborativefusion.com>)
List pgsql-performance
Bill Moran <wmoran@collaborativefusion.com> writes:
> tarcizioab@c3sl.ufpr.br wrote:
>> The commands "\timing" and "EXPLAIN ANALYZE" return values related to the
>> time of execution of the instruction. These values are "Time:" and "Total
>> runtime:" respectively. What is the difference between these values, and
>> the specific use of each command in queries?

> The time reported by explain will be the time it took the server to
> execute the query.

> The time reported by \timing is the time it takes the client (psql) to
> get the result.  This will be the time the server took, plus any network
> delays and time required to process the query and result on the client
> side.

Also realize that explain analyze only reports the time to *execute*
the query.  Not counted are the time to parse and plan the query
beforehand and prepare the explain output afterwards.  But psql's number
is the whole round-trip time and so includes all that stuff.

If any of this seems confusing, you might find it worth reading
this overview of the Postgres system structure:
http://www.postgresql.org/docs/8.3/static/overview.html

            regards, tom lane

pgsql-performance by date:

Previous
From: Bill Moran
Date:
Subject: Re: Difference between "Explain analyze" and "\timing"
Next
From: Miernik
Date:
Subject: why "WHERE uid NOT IN" is so slow, and EXCEPT in the same situtation is fast?