Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: Difference between "Explain analyze" and "\timing"


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: Bill Moran <wmoran(at)collaborativefusion(dot)com>
  • Cc: tarcizioab(at)c3sl(dot)ufpr(dot)br, pgsql-performance(at)postgresql(dot)org
  • Subject: Re: Difference between "Explain analyze" and "\timing"
  • Date: Wed, 30 Jul 2008 21:06:38 -0400
  • Message-id: <26508.1217466398@sss.pgh.pa.us> <text/plain>

Bill Moran <wmoran(at)collaborativefusion(dot)com> writes:
> tarcizioab(at)c3sl(dot)ufpr(dot)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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group