From 23e5b16c71f2706978c5f54aabd28ed23a54b6a5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 17 Jul 2011 14:19:31 -0400 Subject: Add temp_file_limit GUC parameter to constrain temporary file space usage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The limit is enforced against the total amount of temp file space used by each session. Mark Kirkwood, reviewed by Cédric Villemain and Tatsuo Ishii --- src/backend/utils/misc/guc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/backend/utils/misc/guc.c') diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 72e93107910..3b33549a571 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -425,6 +425,8 @@ int log_min_duration_statement = -1; int log_temp_files = -1; int trace_recovery_messages = LOG; +int temp_file_limit = -1; + int num_temp_buffers = 1024; char *data_directory; @@ -535,6 +537,8 @@ const char *const config_group_names[] = gettext_noop("Resource Usage"), /* RESOURCES_MEM */ gettext_noop("Resource Usage / Memory"), + /* RESOURCES_DISK */ + gettext_noop("Resource Usage / Disk"), /* RESOURCES_KERNEL */ gettext_noop("Resource Usage / Kernel Resources"), /* RESOURCES_VACUUM_DELAY */ @@ -1693,6 +1697,17 @@ static struct config_int ConfigureNamesInt[] = check_max_stack_depth, assign_max_stack_depth, NULL }, + { + {"temp_file_limit", PGC_SUSET, RESOURCES_DISK, + gettext_noop("Limits the total size of all temp files used by each session."), + gettext_noop("-1 means no limit."), + GUC_UNIT_KB + }, + &temp_file_limit, + -1, -1, INT_MAX, + NULL, NULL, NULL + }, + { {"vacuum_cost_page_hit", PGC_USERSET, RESOURCES_VACUUM_DELAY, gettext_noop("Vacuum cost for a page found in the buffer cache."), -- cgit v1.2.3