From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Andy Kriger <akriger(at)greaterthanone(dot)com> |
Cc: | Pgsql-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: how do i find out how long a query took? |
Date: | 2002-09-30 16:11:15 |
Message-ID: | 200209301611.g8UGBF823404@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Andy Kriger wrote:
> Is there a psql function I can call after making a query to find out how
> long the last query took? (e.g. after running a create index on a table with
> a lot of records, I would like to know how long it took). I know I could do
> this using JDBC and wrapping the query in getTimeMillis() but I'm curious if
> psql has a built-in function or if the client has a utility cmd.
Yes, you can use \timing in psql:
test=> \timing
Timing is on.
test=> select * from pg_language;
lanname | lanispl | lanpltrusted | lanplcallfoid | lanvalidator |
lanacl
----------+---------+--------------+---------------+--------------+--------
sql | f | t | 0 | 2248 | {=U}
internal | f | f | 0 | 2246 | {=}
c | f | f | 0 | 2247 | {=}
(3 rows)
Time: 76.83 ms
and in 7.3 we will have log_duration which will send all query
durations to the server logs.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-09-30 16:20:54 | Re: [SQL] CURRENT_TIMESTAMP |
Previous Message | Dan Langille | 2002-09-30 16:10:29 | Re: [GENERAL] arrays |