Re: TIMING A QUERY ??? - Mailing list pgsql-performance

From Gregory Stark
Subject Re: TIMING A QUERY ???
Date
Msg-id 87bqeiapk2.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: TIMING A QUERY ???  (Andrew Sullivan <ajs@crankycanuck.ca>)
Responses Re: TIMING A QUERY ???
List pgsql-performance
"Andrew Sullivan" <ajs@crankycanuck.ca> writes:

> On Wed, Jul 11, 2007 at 08:21:40AM -0700, smiley2211 wrote:
>>
>> How can I get the time it takes a query to execute - explain analyze is
>> taking over 5 hours to complete
>
> You can't get it any faster than what explain analyse does: it runs
> the query.  How else would you get the answer?

explain analyze does actually run slower than the actual query because it has
to check the time before and after each step of the query, potentially
thousands of times. If it's a disk-bound query that doesn't matter much but if
it's a cpu-bound query it can.

>> ...can I use \timing???  I don't get any time when using the
>> \timing option...

Yes you can use \timing. You'll have to provide more information of what
you're doing before anyone can help you.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: TIMING A QUERY ???
Next
From: "Jignesh K. Shah"
Date:
Subject: Re: PostgreSQL publishes first real benchmark