Re: Timing a query - Mailing list pgsql-general

From Greg Sabino Mullane
Subject Re: Timing a query
Date
Msg-id E168jiH-0002Jj-00@mclean.mail.mindspring.net
Whole thread Raw
In response to Timing a query  ("Elizabeth O'Neill" <elizabeth.oneill@abcmail.co.uk>)
Responses Re: Timing a query
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Can someone tell me if there is a way of getting the time a
> query has taken to run to display after the query results (
> where in gives the row count).

If you have a recent version of Postgresql, you can do an
EXPLAIN ANALYZE before the actual query:

EXPLAIN ANALYZE SELECT (*) FROM mytable WHERE foo=12;

Alteratively, I wrote a small patch for psql that tells
you how long every query you run takes. It may not work
on your version: please always state which version you
are running when posting a question. If you want to use my
patch and it does not work with your version, let me know
and I'll tweak it so it does.

http://www.gtsm.com/postgres/microtiming.patch


Greg Sabino Mullane
greg@turnstep.com
PGP Key: 0x14964AC8 200111271003


-----BEGIN PGP SIGNATURE-----
Comment: http://www.gtsm.com/pgp.html

iQA/AwUBPAOrcrybkGcUlkrIEQLjZQCfepfTDzVHkY3kO6j/po1FFRi4qVEAn1Ye
Ih8pBO7jXx1lOTnp8ZoTD0oc
=AU0N
-----END PGP SIGNATURE-----





pgsql-general by date:

Previous
From: "Roderick A. Anderson"
Date:
Subject: Re: Row Limit?
Next
From: Tom Lane
Date:
Subject: Re: psql timeout