Re: How to trace client sql requests?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to trace client sql requests?
Date: 2009-07-10 18:58:35
Message-ID: 20090710185835.GC9074@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 10, 2009 at 01:38:57PM -0400, James B. Byrne wrote:
> I have a situation with a Rails project where test data in
> mysteriously "disappearing" in the middle of a test run. I would
> like to see the exact SQL of all client requests issued against a
> single table during a fixed time span.
> How can I best accomplish this in PostgreSQL?
> #client_min_messages = notice
> #log_min_messages = notice
> #log_min_duration_statement = -1
> ...
> #log_duration = off
>
> Which of these, if any, should I alter; and to what? Am I

I prefer to set log_min_duration_statement to 0. It will log all queries
and their running time.

> constrained to system wide logging or can this be enabled by
> database?

You can enable by database:

alter database x set log_min_duration_statement = 0;

Best regards,

depesz

--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Armbrust 2009-07-10 19:25:47 Re: Checkpoint Tuning Question
Previous Message Jeff Davis 2009-07-10 17:51:47 Re: Overhead of union versus union all