Re: how to get current sql execution time?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: sunpeng <bluevaley(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to get current sql execution time?
Date: 2010-10-15 01:29:54
Message-ID: 4CB7AE92.9090308@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 15/10/2010 6:47 AM, sunpeng wrote:
> when I use the psql to send a sql, how to get current sql execution time?

In addition to \timing as others have mentioned, you can use:

EXPLAIN ANALYZE [your-sql-here];

to get the server to tell you how it executed your SQL. If you do this,
the server won't return the query results, it'll instead return query
plan and timing data. Because of that, EXPLAIN ANALYZE doesn't include
the time it takes to transfer the results to the client, only the time
the server took to execute the query and how it executed it.

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guy Rouillier 2010-10-15 04:27:26 Re: It it possible to get this result in one query?
Previous Message Nick 2010-10-15 01:05:38 Re: It it possible to get this result in one query?