Query timing

Started by Naz Gassiepabout 19 years ago5 messagesgeneral
Jump to latest
#1Naz Gassiep
naz@mira.net

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.

#2Jorge Godoy
jgodoy@gmail.com
In reply to: Naz Gassiep (#1)
Re: Query timing

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>

#3A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Naz Gassiep (#1)
Re: Query timing

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

#4Naz Gassiep
naz@mira.net
In reply to: Jorge Godoy (#2)
Re: Query timing

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:

Show quoted text

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.

#5Robert Treat
xzilla@users.sourceforge.net
In reply to: Naz Gassiep (#4)
Re: Query timing

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