Logging both start and end of temporary file usage

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Logging both start and end of temporary file usage
Date: 2012-07-12 06:59:27
Message-ID: 1ECA957F-646E-4597-9481-3654F270E733@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In working with s a client to analyze their temp file usage, it became useful to know when a temporary file was created as well as when it was closed. That way, we could process the logs to determine a high water mark of overall temp file usage, to know how high it was safe (in that workload) to set work_mem. So, I wrote a quick patch that logged both the open and close of the temp file.

Since the final size of the file isn't known at the time that the file is created, the patch just logs the filename. The particular file can be correlated with the size by the name when the close message is logged. Of course, there's no information about the pattern of the file size over time, but it's a bit more information than was there before.

As we don't know the size of the file until close time, the open is only logged if log_temp_files is 0 (the idea being that's "maximum logging").

If this sounds like something worthwhile in general, I can package it up as a proper patch.
--
-- Christophe Pettus
xof(at)thebuild(dot)com

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2012-07-12 07:13:21 Re: Support for XLogRecPtr in expand_fmt_string?
Previous Message Joel Jacobson 2012-07-12 06:50:31 Re: Schema version management