Patch proposal for log_duration - Mailing list pgsql-patches

From Guillaume Smet
Subject Patch proposal for log_duration
Date
Msg-id 1d4e0c10603300622o778da2adv66cc26d9cd7dc861@mail.gmail.com
Whole thread Raw
Responses Re: Patch proposal for log_duration
List pgsql-patches
Hi,

This patch is a followup of a discussion on -hackers about the new
behaviour of log_duration in 8.x (
http://archives.postgresql.org/pgsql-hackers/2006-03/msg00687.php ).

As explained in the previous thread, we used to play with log_duration
and log_min_error_statement to have the following behaviour:
- log every duration so that we can have a global overview of the
database activity;
- log statement only for slowest queries.

This setting is not yet possible with 8.x as log_duration only logs
duration for queries logged with log_statement. On our production
server, we cannot set log_statement to 'all' as it generates far too
many writes on disks when logging the text of all the queries
executed. But it's really useful for us to have a global overview of
the database activity, not only slowest queries.

FYI, our log file is used to generate this sort of report:
http://pgfouine.projects.postgresql.org/reports/sample_hourly.html .

This patch introduces back the ability to log every duration while
keeping the new 8.x behaviour.
You can set:
- log_duration to 'none' = old off value
- log_duration to 'logged' = on value for 8.x: log duration only if
the query is logged by log_statement
- log_duration to 'all' = on value for 7.4: we log duration for every
statement executed.

Patch is against current CVS head and make check is OK. I tested it
with CVS and I backported it to 8.1.3 too to test it on one of our
test server using 8.1.

Please let me know if this patch needs any change as it's my first
attempt to patch PostgreSQL.

Regards,

--
Guillaume

Attachment

pgsql-patches by date:

Previous
From: Philip Yarra
Date:
Subject: Re: Show tablespace for databases with psql's \l+
Next
From: Tom Lane
Date:
Subject: Re: Patch proposal for log_duration