Re: Timing a query

From: "Greg Sabino Mullane" <greg(at)turnstep(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Timing a query
Date: 2001-11-27 15:04:41
Message-ID: E168jiH-0002Jj-00@mclean.mail.mindspring.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)turnstep(dot)com
PGP Key: 0x14964AC8 200111271003

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

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-11-27 15:13:07 Re: help postgres
Previous Message Tom Lane 2001-11-27 15:03:58 Re: psql timeout