Created
June 11, 2013 17:01
-
-
Save Ilink/5758629 to your computer and use it in GitHub Desktop.
fastgin_mem_limit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e3e7aa2249984e409f077732ee8cd95ff656f2a5 Mon Sep 17 00:00:00 2001 | |
From: Ian Link <Ian@Angler.(none)> | |
Date: Mon, 10 Jun 2013 23:19:07 -0700 | |
Subject: [PATCH] added separate limit for fastgin memory | |
--- | |
src/backend/access/gin/ginfast.c | 3 ++- | |
src/backend/utils/init/globals.c | 1 + | |
src/backend/utils/misc/guc.c | 12 ++++++++++++ | |
src/include/miscadmin.h | 1 + | |
4 files changed, 16 insertions(+), 1 deletions(-) | |
diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c | |
index 4f2c118..a12e384 100644 | |
--- a/src/backend/access/gin/ginfast.c | |
+++ b/src/backend/access/gin/ginfast.c | |
@@ -426,7 +426,8 @@ ginHeapTupleFastInsert(GinState *ginstate, GinTupleCollector *collector) | |
* | |
* ginInsertCleanup() should not be called inside our CRIT_SECTION. | |
*/ | |
- if (metadata->nPendingPages * GIN_PAGE_FREESIZE > work_mem * 1024L) | |
+ | |
+ if (metadata->nPendingPages * GIN_PAGE_FREESIZE > fastgin_mem * 1024L) | |
needCleanup = true; | |
UnlockReleaseBuffer(metabuffer); | |
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c | |
index 9f51929..e436d24 100644 | |
--- a/src/backend/utils/init/globals.c | |
+++ b/src/backend/utils/init/globals.c | |
@@ -99,6 +99,7 @@ int CTimeZone = 0; | |
bool enableFsync = true; | |
bool allowSystemTableMods = false; | |
int work_mem = 1024; | |
+int fastgin_mem = 128; | |
int maintenance_work_mem = 16384; | |
/* | |
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c | |
index ea16c64..2d46a11 100644 | |
--- a/src/backend/utils/misc/guc.c | |
+++ b/src/backend/utils/misc/guc.c | |
@@ -1711,6 +1711,18 @@ static struct config_int ConfigureNamesInt[] = | |
}, | |
{ | |
+ {"fastgin_mem", PGC_USERSET, RESOURCES_MEM, | |
+ gettext_noop("Sets the maximum memory to be used for fastgin operations."), | |
+ gettext_noop("This represents the maximum amount of space stored in " | |
+ "the fasgin heap."), | |
+ GUC_UNIT_KB | |
+ }, | |
+ &fastgin_mem, | |
+ 128, 64, MAX_KILOBYTES, | |
+ NULL, NULL, NULL | |
+ }, | |
+ | |
+ { | |
{"maintenance_work_mem", PGC_USERSET, RESOURCES_MEM, | |
gettext_noop("Sets the maximum memory to be used for maintenance operations."), | |
gettext_noop("This includes operations such as VACUUM and CREATE INDEX."), | |
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h | |
index be3add9..a8331e3 100644 | |
--- a/src/include/miscadmin.h | |
+++ b/src/include/miscadmin.h | |
@@ -230,6 +230,7 @@ extern int CTimeZone; | |
extern bool enableFsync; | |
extern bool allowSystemTableMods; | |
extern PGDLLIMPORT int work_mem; | |
+extern PGDLLIMPORT int fastgin_mem; | |
extern PGDLLIMPORT int maintenance_work_mem; | |
extern int VacuumCostPageHit; | |
-- | |
1.7.9 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment