Re: Timing a query

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Timing a query
Дата
Msg-id E168ld8-00029R-00@mclean.mail.mindspring.net
обсуждение исходный текст
Ответ на Timing a query  ("Elizabeth O'Neill" <elizabeth.oneill@abcmail.co.uk>)
Ответы Re: Timing a query  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> How recent? 7.2 beta?
> I tried it on 7.1.3 and didn't have it.

Yes, it is a 7.2 feature.

> Could you include the output of "EXPLAIN ANALYZE" I
> would like to see what it gives.

template1=# EXPLAIN ANALYZE SELECT foo,bar FROM baz;

NOTICE:  QUERY PLAN:

Seq Scan on baz  (cost=0.00..20.00 rows=1000 width=8) (actual time=0.01..0.01 rows=0 loops=1)
Total runtime: 0.06 msec

> This seems to be such a commonly needed task. Shouldn't this be
> incorporated into psql?

I still like my patch: it performs a little differently from the
EXPLAIN ANALYZE function. You turn it on and off with the
a "\m", and it records the time it takes everything to run,
even things like index creation, which EXPLAIN ANALYZE does not
handle. Plus, you don't have to go back and re-run the query
if you want to time it: it simply presents the timing information
after every query, until you turn the option off:

template1=# SELECT count(*) FROM baz;

 count
- -------
 15212

TOTAL TIME: 0.004665

template1=# CREATE INDEX foobar ON baz(waldo);

CREATE

TOTAL TIME: 0.011012


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

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

iQA/AwUBPAPITrybkGcUlkrIEQI7qQCggBpgODxZ6Sv2iUqYrMYAffEDpUoAn2G+
W7PQpuxwrXzy/jXsRiOhxb8i
=NxuD
-----END PGP SIGNATURE-----



В списке pgsql-general по дате отправления:

Предыдущее
От: David Wheeler
Дата:
Сообщение: Re: DBD::Pg BYTEA Character Escaping
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Timing a query