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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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 Content-Type Size
log_duration.patch.gz application/x-gzip 3.0 KB

Responses

Browse pgsql-patches by date

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