log_duration and log_statement - Mailing list pgsql-hackers

From Guillaume Smet
Subject log_duration and log_statement
Date
Msg-id 1d4e0c10603131440l1993255bh9d9bb2cb026f700@mail.gmail.com
Whole thread Raw
Responses Re: log_duration and log_statement
List pgsql-hackers
Hello,

Here are some background information to explain our issue and request.
We are currently planning a migration from PostgreSQL 7.4 to
PostgreSQL 8.1. We work on a medium sized database (2GB) with a rather
important activity (12 millions queries a day with peaks up to 1000
queries/s).
We are analyzing the logs with a tool we developed (namely pgFouine
available on pgFoundry). We currently use the following configuration
for logging:
- log_min_duration_statement = 500 to log the slowest queries
- log_duration to log every query duration and have a global overview
of our database activity (used to generate this sort of graphs:
http://people.openwide.fr/~gsmet/postgresql/graphs.html ).
We cannot log every query as we already generate 1.2GB of logs a day
while only logging the text of one hundredth of the queries so we log
only the duration for the "not so slow" queries.

I didn't notice the log_duration behaviour has changed starting from
8.0 (thanks to oicu for pointing me the 8.0 release notes on
#postgresql) and what we did is not possible anymore with 8.x as
log_duration now only logs the duration for queries logged with
log_statement.

I think the former behaviour can be interesting in our case and
probably for many other people out there who use log analysis tools as
logging only slow queries is not enough to have an overview of the
database activity.
I was thinking about something like log_duration = 'none|logged|all'
which will allow us to switch between:
- none: we don't log the duration (=log_duration=off);
- logged: we log the duration only for logged queries (depending on
log_statement as for 8.0);
- all: we log every duration as 7.4 did before when log_duration was on.

Any comment on this?

Thanks in advance for considering my request.

Regards,

--
Guillaume


pgsql-hackers by date:

Previous
From: "Jonah H. Harris"
Date:
Subject: Re: DB2-style INS/UPD/DEL RETURNING
Next
From: Gavin Sherry
Date:
Subject: Re: DB2-style INS/UPD/DEL RETURNING