Skip site navigation (1) Skip section navigation (2)

Patch proposal for log_duration

From: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Patch proposal for log_duration
Date: 2006-03-30 14:22:12
Message-ID: 1d4e0c10603300622o778da2adv66cc26d9cd7dc861@mail.gmail.com (view raw or flat)
Thread:
Lists: 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: log_duration.patch.gz
Description: application/x-gzip (3.0 KB)

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2006-03-30 16:31:17
Subject: Re: Patch proposal for log_duration
Previous:From: Philip YarraDate: 2006-03-30 03:32:39
Subject: Re: Show tablespace for databases with psql's \l+

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group