Thread: Query time

Query time

From
Laura Castro
Date:
  Hi all,

  I'm interested in measuring how much time different sql-queries spent,
but I don't know how to do it in postgresql. Any idea?
  Perhaps that's a way of analyzing it at some kind of log file or so...

  Thank you very much in advance.

    Laura Castro


Re: Query time

From
Bruce Momjian
Date:
Using postgresql.conf or SET, you can enable timestamps on the log file,
and 7.2 psql has a \timing command.  Also EXPLAIN ANALYZE query shows
times.

Actually, we should have something that shoots out just the query and
the duration into the log file.  I don't see that capability now.

I see it on the TODO list:

    * Allow logging of query durations

---------------------------------------------------------------------------

Laura Castro wrote:
>
>   Hi all,
>
>   I'm interested in measuring how much time different sql-queries spent,
> but I don't know how to do it in postgresql. Any idea?
>   Perhaps that's a way of analyzing it at some kind of log file or so...
>
>   Thank you very much in advance.
>
>     Laura Castro
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026