From: | Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com> |
---|---|
To: | Erik Jones <erik(at)myemma(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Determine query run-time from pg_* tables |
Date: | 2007-10-25 09:33:33 |
Message-ID: | 1193304813.30973.154.camel@neuromancer.home.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 2007-10-23 at 09:28 -0500, Erik Jones wrote:
> > Ow Mun Heng wrote:
> >> Hi,
> >>
> >> Is there a method to obtain the query's runtime from any of the pg_*
> >> tables?
> query_start does, however, give you the time that the query started.
> I use something like
>
> SELECT procpid, client_addr, to_char(now() - query_start, 'DD
> HH24:MI:SS') as query_time, current_query
> FROM pg_stat_activity
> ORDER BY query_time DESC;
Thanks for this.. but I found that this query doesn't really do much for
the query_time. It's always 00 for a long runnig query >1min.
I've re-wrote it using
SELECT procpid, client_addr, now() - query_start as query_time,
current_query
FROM pg_stat_activity
ORDER BY query_time DESC;
the to_char doesn't really do much for me..
Thanks for the pointer though.. It led me to the right direction.
From | Date | Subject | |
---|---|---|---|
Next Message | Ow Mun Heng | 2007-10-25 09:37:57 | Re: Indexes & Primary Keys (based on the same columns) |
Previous Message | Reg Me Please | 2007-10-25 09:14:34 | Re: [PGSQL v8.2.5] Similar queries behave differently |