Phase 2: Optimize memory configuration for low-memory fork

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.
pull/565/head
Oliver Rice 2025-09-20 11:24:37 -05:00
parent b3e83f3995
commit 28e8a8e3be
1 changed files with 5 additions and 5 deletions

10
guc.c
View File

@ -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 */