Thread: Query timing

Query timing

From
Naz Gassiep
Date:
Using EXPLAIN ANALYZE I can get the execution time of a query. Is there
a command I can use to get the execution time without the planning
information? I just need to time lots of queries that have complex plans
and it'd be easier if I didn't have pages and pages of planning info
between tries. The queries themselves are one line each, but refer to
views, which make the plans pretty complex. Being able to see several
times in one terminal window would be easier.

Thanks,
- Naz.

Re: Query timing

From
Jorge Godoy
Date:
Naz Gassiep <naz@mira.net> writes:

> Using EXPLAIN ANALYZE I can get the execution time of a query. Is there a
> command I can use to get the execution time without the planning information?
> I just need to time lots of queries that have complex plans and it'd be easier
> if I didn't have pages and pages of planning info between tries. The queries
> themselves are one line each, but refer to views, which make the plans pretty
> complex. Being able to see several times in one terminal window would be
> easier.

Write the queries in a file, run them with psql -f and grep for the desired
lines only.

--
Jorge Godoy      <jgodoy@gmail.com>

Re: Query timing

From
"A. Kretschmer"
Date:
am  Mon, dem 05.03.2007, um 15:28:29 +1100 mailte Naz Gassiep folgendes:
> Using EXPLAIN ANALYZE I can get the execution time of a query. Is there
> a command I can use to get the execution time without the planning

Within psql, the command-line-interface, you can use \timing to switch
on/off reporting the execution time.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Query timing

From
Naz Gassiep
Date:
That's not quite as fast as I would like to do it, that throws in a few
more steps which slow down the development process. However if there is
no way I will persevere with the method I have now.
Thanks,
- Naz.

Jorge Godoy wrote:
> Naz Gassiep <naz@mira.net> writes:
>
>
>> Using EXPLAIN ANALYZE I can get the execution time of a query. Is there a
>> command I can use to get the execution time without the planning information?
>> I just need to time lots of queries that have complex plans and it'd be easier
>> if I didn't have pages and pages of planning info between tries. The queries
>> themselves are one line each, but refer to views, which make the plans pretty
>> complex. Being able to see several times in one terminal window would be
>> easier.
>>
>
> Write the queries in a file, run them with psql -f and grep for the desired
> lines only.
>
>

Re: Query timing

From
Robert Treat
Date:
On Monday 05 March 2007 02:38, Naz Gassiep wrote:
> That's not quite as fast as I would like to do it, that throws in a few
> more steps which slow down the development process. However if there is
> no way I will persevere with the method I have now.
> Thanks,
> - Naz.
>

There are several logging parameters in the postgresql.conf, including
log_duration.  Logging to a file also has a bonus that you can feed it into a
query analyzing program like pgfouine or pqa.

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL