Re: [GENERAL] get a log of queries that take up a lot of CPU or take a very long time.

2009-11-24 Thread Sam Jas
select procpid, current_query, now() - query_start as duration, backend_start
from pg_stat_activity where current_query not like '%IDLE%' order by duration 
desc
limit 10;

Hope it may help you!!!.


--
Thanks 
Sam Jas


--- On Mon, 23/11/09, Tim Uckun  wrote:

From: Tim Uckun 
Subject: [GENERAL] get a log of queries that take up a lot of CPU or take a 
very long  time.
To: "pgsql-general" 
Date: Monday, 23 November, 2009, 10:41 PM

Is there a way I can get a list of the top 10 longest running queries
for the day/week/month or the top 10 queries that took the most CPU?

select * from pg_stat_activity only shows the current status.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/

Re: [GENERAL] get a log of queries that take up a lot of CPU or take a very long time.

2009-11-23 Thread Alan Hodgson
On Monday 23 November 2009, Tim Uckun  wrote:
> Is there a way I can get a list of the top 10 longest running queries
> for the day/week/month or the top 10 queries that took the most CPU?
>
> select * from pg_stat_activity only shows the current status.

You can enable query logging, store the logs, and parse them.

-- 
"No animals were harmed in the recording of this episode. We tried but that 
damn monkey was just too fast."

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] get a log of queries that take up a lot of CPU or take a very long time.

2009-11-23 Thread Tim Uckun
Is there a way I can get a list of the top 10 longest running queries
for the day/week/month or the top 10 queries that took the most CPU?

select * from pg_stat_activity only shows the current status.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general