From 50ce1e0298165c00a60efa5efa11383e8acd2f60 Mon Sep 17 00:00:00 2001 From: Rich Turner <7072278+richturner@users.noreply.github.com> Date: Fri, 20 Nov 2026 11:57:38 +0000 Subject: [PATCH] Set PostgreSQL idle in transaction session timeout in deploy profile Pass POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT (default 10min) to the postgresql service so sessions left idle in a transaction are terminated before they can prevent autovacuum removing dead rows. Requires an openremote/postgresql image that supports the variable; older images ignore it. --- profile/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profile/deploy.yml b/profile/deploy.yml index ecb9c66497..01e8a426d8 100644 --- a/profile/deploy.yml +++ b/profile/deploy.yml @@ -487,6 +487,9 @@ services: # This setting may still be overridden depending on your kernel settings so tune this and other # service DB values so the actual max connections are not exhausted POSTGRES_MAX_CONNECTIONS: ${POSTGRES_MAX_CONNECTIONS:-50} + # Terminates sessions left idle in a transaction for longer than this, as they prevent autovacuum removing dead + # rows and cause table bloat (set to 0 to disable) + POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT: ${POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT:-10min} # Query Exporter - Prometheus metrics from PostgreSQL queries # Documentation: https://github.com/albertodonato/query-exporter