From 4ae3f4548cdd58f16ced1007b9f02634e8281c3c Mon Sep 17 00:00:00 2001 From: Igor Ohrimenko Date: Mon, 27 Jul 2026 08:03:51 +0300 Subject: [PATCH 1/2] docs(general): document query_cache_memory_limit and query_cache_ttl Adds reference entries for the byte-based query cache memory budget and the idle-expiry TTL (pgdogdev/pgdog#1266), plus SHOW CONFIG table rows. --- docs/administration/config.md | 2 ++ docs/configuration/pgdog.toml/general.md | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/administration/config.md b/docs/administration/config.md index 016382d7..88015152 100644 --- a/docs/administration/config.md +++ b/docs/administration/config.md @@ -46,6 +46,8 @@ The following configuration parameters are available and their current values: | `prepared_statements_limit` [:material-link:](../configuration/pgdog.toml/general.md#prepared_statements_limit) | `500` | | `pub_sub_channel_size` [:material-link:](../configuration/pgdog.toml/general.md#pub_sub_channel_size) | `4098` | | `query_cache_limit` | `500` | +| `query_cache_memory_limit` [:material-link:](../configuration/pgdog.toml/general.md#query_cache_memory_limit) | `0` | +| `query_cache_ttl` [:material-link:](../configuration/pgdog.toml/general.md#query_cache_ttl) | `0` | | `query_log` | `default` | | `query_timeout` [:material-link:](../configuration/pgdog.toml/general.md#query_timeout) | `1s` | | `read_write_split` [:material-link:](../configuration/pgdog.toml/general.md#read_write_split) | `include_primary` | diff --git a/docs/configuration/pgdog.toml/general.md b/docs/configuration/pgdog.toml/general.md index 182b684c..ac9523f3 100644 --- a/docs/configuration/pgdog.toml/general.md +++ b/docs/configuration/pgdog.toml/general.md @@ -474,6 +474,21 @@ Limit on the number of statements saved in the statement cache used to accelerat Default: **`1_000`** +### `query_cache_memory_limit` + +Approximate memory budget, in bytes, for the statement cache. Entries are evicted in LRU order once the sum of their sizes exceeds the budget. Unlike the count-based [`query_cache_limit`](#query_cache_limit), this bounds memory usage regardless of query size and complexity. Setting this to `0` disables the memory cap. + +!!! note + Entry sizes are measured with jemalloc. On builds without jemalloc, the budget is approximated from query text length. + +Default: **`0`** (disabled) + +### `query_cache_ttl` + +Time-to-idle, in seconds, for statement cache entries. An entry not accessed within this window is removed by the maintenance sweep. Setting this to `0` disables idle expiry. + +Default: **`0`** (disabled) + ### `query_parser_enabled` !!! warning "Deprecated setting" From 83fa2cdaad245731f72d110fb8862954063370ad Mon Sep 17 00:00:00 2001 From: Igor Ohrimenko Date: Sat, 1 Aug 2026 17:02:49 +0300 Subject: [PATCH 2/2] docs(general): rename query_cache_ttl to query_cache_idle_timeout (milliseconds) Follows the rename in pgdogdev/pgdog#1266: the behaviour is idle expiry (counted from last access), so the option reuses the existing idle-timeout naming and the millisecond unit of the other *_timeout options. --- docs/administration/config.md | 2 +- docs/configuration/pgdog.toml/general.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/administration/config.md b/docs/administration/config.md index 88015152..958f2972 100644 --- a/docs/administration/config.md +++ b/docs/administration/config.md @@ -45,9 +45,9 @@ The following configuration parameters are available and their current values: | `prepared_statements` [:material-link:](../configuration/pgdog.toml/general.md#prepared_statements) | `extended` | | `prepared_statements_limit` [:material-link:](../configuration/pgdog.toml/general.md#prepared_statements_limit) | `500` | | `pub_sub_channel_size` [:material-link:](../configuration/pgdog.toml/general.md#pub_sub_channel_size) | `4098` | +| `query_cache_idle_timeout` [:material-link:](../configuration/pgdog.toml/general.md#query_cache_idle_timeout) | `0` | | `query_cache_limit` | `500` | | `query_cache_memory_limit` [:material-link:](../configuration/pgdog.toml/general.md#query_cache_memory_limit) | `0` | -| `query_cache_ttl` [:material-link:](../configuration/pgdog.toml/general.md#query_cache_ttl) | `0` | | `query_log` | `default` | | `query_timeout` [:material-link:](../configuration/pgdog.toml/general.md#query_timeout) | `1s` | | `read_write_split` [:material-link:](../configuration/pgdog.toml/general.md#read_write_split) | `include_primary` | diff --git a/docs/configuration/pgdog.toml/general.md b/docs/configuration/pgdog.toml/general.md index ac9523f3..59ae14db 100644 --- a/docs/configuration/pgdog.toml/general.md +++ b/docs/configuration/pgdog.toml/general.md @@ -483,9 +483,9 @@ Approximate memory budget, in bytes, for the statement cache. Entries are evicte Default: **`0`** (disabled) -### `query_cache_ttl` +### `query_cache_idle_timeout` -Time-to-idle, in seconds, for statement cache entries. An entry not accessed within this window is removed by the maintenance sweep. Setting this to `0` disables idle expiry. +Idle timeout, in milliseconds, for statement cache entries. An entry not accessed within this window is removed by the maintenance sweep. Setting this to `0` disables idle expiry. Default: **`0`** (disabled)