From 28e8a8e3be1adee501f479411c3c2a888a860d57 Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Sat, 20 Sep 2025 11:24:37 -0500 Subject: [PATCH] Phase 2: Optimize memory configuration for low-memory fork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reduce default memory usage from 276MB to ~3MB: - pgsm_max: 256MB → 2MB (99% reduction) - pgsm_max_buckets: 10 → 2 (fewer time segments) - pgsm_query_shared_buffer: 20MB → 1MB (95% reduction) - pgsm_query_max_len: 2048 → 1536 (matches export limit) Total memory footprint: 276MB → 3MB (99% reduction) Maintains full monitoring functionality with conservative resource usage. --- guc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/guc.c b/guc.c index d6fb16e..0f31b65 100644 --- a/guc.c +++ b/guc.c @@ -55,8 +55,8 @@ init_guc(void) "Sets the maximum size of shared memory in (MB) used for statement's metadata tracked by pg_stat_monitor.", /* short_desc */ NULL, /* long_desc */ &pgsm_max, /* value address */ - 256, /* boot value */ - 10, /* min value */ + 2, /* boot value - reduced from 256MB to 2MB for low-memory fork */ + 1, /* min value - reduced from 10 to allow lower memory usage */ 10240, /* max value */ PGC_POSTMASTER, /* context */ GUC_UNIT_MB, /* flags */ @@ -69,7 +69,7 @@ init_guc(void) "Sets the maximum length of query.", /* short_desc */ NULL, /* long_desc */ &pgsm_query_max_len, /* value address */ - 2048, /* boot value */ + 1536, /* boot value - reduced from 2048 to match export limit */ 1024, /* min value */ INT_MAX, /* max value */ PGC_POSTMASTER, /* context */ @@ -83,7 +83,7 @@ init_guc(void) "Sets the maximum number of buckets.", /* short_desc */ NULL, /* long_desc */ &pgsm_max_buckets, /* value address */ - 10, /* boot value */ + 2, /* boot value - reduced from 10 to 2 for low-memory fork */ 1, /* min value */ 20000, /* max value */ PGC_POSTMASTER, /* context */ @@ -153,7 +153,7 @@ init_guc(void) "Sets the maximum size of shared memory in (MB) used for query tracked by pg_stat_monitor.", /* short_desc */ NULL, /* long_desc */ &pgsm_query_shared_buffer, /* value address */ - 20, /* boot value */ + 1, /* boot value - reduced from 20MB to 1MB for low-memory fork */ 1, /* min value */ 10000, /* max value */ PGC_POSTMASTER, /* context */