Re: Real time query analyzer

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Real time query analyzer
Date: 2006-10-16 15:55:09
Message-ID: 20061016155509.GB13156@KanotixBox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Suciu <adrian(dot)suciu(at)netopia-system(dot)com> schrieb:

> Hi everybody!
> I ask you for your help on a problem I have.
> I have a postgresql 7.4 running on a dual 4 GB RAM server, but I have some
> VERY memory intense queries, that put processor up to 40%. I see all this
> info in unix "top" command or ps -aux
> Unfortunately they don't show me the query itsself.
>
> Is there a tool for postgres that can show me the queries and the time they
> take and the amount of processor is consuming (as Oracle has) ?

You can do some things:

- set log_min_duration_statement = X to log all statments with a
duration more than X ms. I'm not sure, if this possible with 7.4
- select * from pg_stat_activity;
you should enable stats_command_string ;-)

Now you can identify your expensive querys and anaylse this with
EXPLAIN.

17:53 < akretschmer> ??explain
17:53 < rtfm_please> For information about explain
17:53 < rtfm_please> see http://techdocs.postgresql.org/oscon2005/robert.treat/OSCON_Explaining_Explain_Public.sxi
17:53 < rtfm_please> or http://www.postgresql.org/docs/current/static/sql-explain.html

Read the links above to learn more about EXPLAIN.

HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2006-10-16 16:41:17 Re: [GENERAL] ISO week dates
Previous Message Andreas Kretschmer 2006-10-16 15:40:37 Re: Dates rejected