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.



Attachment: log_duration.patch.gz
Description: GNU Zip compressed data

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?


Reply via email to