Re: Monitoring Postgres - Get the SQL queries which are sent to postgres

From: Vivek Khera <vivek(at)khera(dot)org>
To: "Pgsql-General(at)Postgresql(dot)Org general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Monitoring Postgres - Get the SQL queries which are sent to postgres
Date: 2006-10-26 18:11:04
Message-ID: 90B34999-558F-4938-9278-2377338B266F@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Oct 25, 2006, at 10:11 AM, A. Kretschmer wrote:

> Set this in your postgresql.conf:
>
> log_statement = all
>
> Reload the server, and then you can find all your statements in the
> log.

or, preferably, on a per-connection basis, execute this SQL statement:

set log_min_duration_statement = 0

then only those queries for that connection will be logged.
otherwise you get *way* too much stuff to sort out.

Another useful setting which I always enable (in my postgresql.conf
file) is

log_min_error_statement = error

so that any statement that generates an error will be appended to the
error log entry. otherwise you just see the error notice and have no
clue what caused it.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2006-10-26 18:27:43 Re: more than 32 parameters to a function?
Previous Message Volkan YAZICI 2006-10-26 18:08:08 Re: more than 32 parameters to a function?