Re: Measuring time of select query

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Measuring time of select query
Дата
Msg-id 200212021803.gB2I3mm10636@candle.pha.pa.us
обсуждение исходный текст
Ответ на Measuring time of select query  (Mariusz Wiktorczyk <kosmat@fanthom.math.put.poznan.pl>)
Список 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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

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

Предыдущее
От: Thorsten Meinl
Дата:
Сообщение: Bug in DatabaseMetaData.getColumns(...)??
Следующее
От: Nic Ferrier
Дата:
Сообщение: Re: streaming result sets: progress