Re: Selects query stats?

From: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>
To: "Dan Gorman" <dgorman(at)hi5(dot)com>
Cc: mischa(at)ca(dot)sophos(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Selects query stats?
Date: 2006-05-23 20:04:36
Message-ID: 1d4e0c10605231304k5d3005fdla5f596e5194578e3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 5/23/06, Dan Gorman <dgorman(at)hi5(dot)com> wrote:
> What I am looking for is that our DB is doing X selects a min.

If you're using 7.4, you can use log_duration to only log duration. It
won't log all the query text, only one short line per query. Then you
can use pgFouine to analyze this and having a graph such like that
http://pgfouine.projects.postgresql.org/reports/sample_hourly.html .
If you only log duration, you won't be able to separate
insert/delete/update from select though. So it can be interesting only
if they negligible.

Note that this is not possible in 8.x. You'll have to log the
statement to log the duration. I proposed a patch but it was refused
as it complexified the log configuration.

> Turning on logging isn't an option as it will create too much IO in
> our enviornment.

What we do here is logging on another machine via the network using
syslog. From our experience, it's not the fact to log that really
slows down the db but the generated I/O load. So if you do that, you
should be able to log the statements without slowing down your
database too much.

On our production databases, we keep the log running all the time and
we generate reports daily.

Regards,

--
Guillaume

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Simon Riggs 2006-05-23 21:47:16 Re: Selects query stats?
Previous Message Jim C. Nasby 2006-05-23 20:02:48 Re: Selects query stats?