From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | kosmat(at)z(dot)pl |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Measuring time of select query |
Date: | 2002-12-02 18:03:48 |
Message-ID: | 200212021803.gB2I3mm10636@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Mariusz Wiktorczyk wrote:
> Hello!
> I have to measure the time of select query via the jdbc driver. I cannot
> do this using only java.sql interfaces :( Is there any possibility to do
> it using yours jdbc driver? Where can I find api docs to postgresql jdbc?
> Best regards
> Mariusz Wiktorczyk
I have a few solutions for you. First, in 7.3, there is the
postgresql.conf variable 'log_duration' which will return the duration
of your query:
test=> SET log_duration TO 'on';
SET
test=> SET client_min_messages TO 'log';
LOG: duration: 0.000682 sec
SET
test=> SELECT * FROM pg_language;
LOG: duration: 0.003959 sec
lanname | lanispl | lanpltrusted | lanplcallfoid | lanvalidator |
lanacl
----------+---------+--------------+---------------+--------------+--------
sql | f | t | 0 | 2248 | {=U}
internal | f | f | 0 | 2246 | {=}
c | f | f | 0 | 2247 | {=}
(3 rows)
Also in 7.3, psql has \timing. I don't know of any good way to do this
in < 7.3, nor in jdbc.
--
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 | Dave Cramer | 2002-12-02 18:06:43 | Re: Measuring time of select query |
Previous Message | Alex Dovlecel | 2002-12-02 17:17:57 | accessing collumn in join ResultSet |