Skip to content

Commit 2d2e9a8

Browse files
committed
feat: query_cache_memory_limit and query_cache_idle_timeout options
Renders the two [general] options added in pgdogdev/pgdog#1266 into pgdog.toml, so operators can set them via values instead of the PGDOG_QUERY_CACHE_MEMORY_LIMIT / PGDOG_QUERY_CACHE_IDLE_TIMEOUT env variables. Both are optional and omitted from the config unless set.
1 parent 63afd8c commit 2d2e9a8

5 files changed

Lines changed: 25 additions & 2 deletions

File tree

Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
apiVersion: v1
22
name: pgdog
3-
version: v0.72
3+
version: v0.73
44
appVersion: "0.1.50"

templates/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ data:
119119
{{- if hasKey .Values "queryCacheLimit" }}
120120
query_cache_limit = {{ include "pgdog.intval" .Values.queryCacheLimit }}
121121
{{- end }}
122+
{{- if hasKey .Values "queryCacheMemoryLimit" }}
123+
query_cache_memory_limit = {{ include "pgdog.intval" .Values.queryCacheMemoryLimit }}
124+
{{- end }}
125+
{{- if hasKey .Values "queryCacheIdleTimeout" }}
126+
query_cache_idle_timeout = {{ include "pgdog.intval" .Values.queryCacheIdleTimeout }}
127+
{{- end }}
122128
{{- if hasKey .Values "passthroughAuth" }}
123129
passthrough_auth = {{ .Values.passthroughAuth | quote }}
124130
{{- end }}

test/values-full.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ readWriteSplit: include_primary
1717
preparedStatements: extended
1818
preparedStatementsLimit: 1000
1919
queryCacheLimit: 500
20+
queryCacheMemoryLimit: 1_073_741_824
21+
queryCacheIdleTimeout: 600_000
2022
passthroughAuth: disabled
2123
connectAttempts: 2
2224
connectAttemptDelay: 100

test/values-pgdog-config-extras.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Covers: ban_replica_lag*, 2PC WAL persistence, resharding copy retries,
33
# query_log, rewrite_shard_key_updates, unique_id_*, cutover_*,
44
# tcp user_timeout/congestion_control, mirroring queue_length/level,
5-
# query_parsers table, database lb_weight/resharding_only, multi_tenant, otel.
5+
# query_parsers table, database lb_weight/resharding_only, multi_tenant, otel,
6+
# query_cache_memory_limit/query_cache_idle_timeout.
67

78
banReplicaLag: 60_000
89
banReplicaLagBytes: 10_000_000
@@ -67,3 +68,6 @@ queryParsers:
6768
- database: primary
6869
level: "off"
6970
engine: pg_query_raw
71+
72+
queryCacheMemoryLimit: 1_073_741_824
73+
queryCacheIdleTimeout: 600_000

values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,17 @@ rdsCertificateBundle:
578578
# memoryMessageBuffer: 8192
579579
# memoryStackSize: 2097152
580580

581+
# Query cache configuration (optional)
582+
# queryCacheMemoryLimit is the memory budget (in bytes) for the query (AST) cache;
583+
# least recently used entries are evicted once the summed entry size exceeds it.
584+
# 0 disables the memory cap.
585+
# queryCacheMemoryLimit: 1073741824
586+
587+
# queryCacheIdleTimeout is the idle timeout (in milliseconds) for query cache
588+
# entries; entries not accessed within this window are dropped by the
589+
# maintenance sweep. 0 disables idle expiry.
590+
# queryCacheIdleTimeout: 600000
591+
581592
# Query parser configuration
582593
# queryParser controls whether the query parser and which features are enabled
583594
# Valid values: "auto", "on", "off", "session_control", "session_control_and_locks"

0 commit comments

Comments
 (0)