mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 17:47:28 +00:00
Each connection of the native Postgres pool caches its prepared statements. A miss costs a round trip to prepare, and the cache is emptied whole when it reaches 512 statements. Nothing showed how often either happens, or how often `txn_limit` replaces a connection and loses its cache. The pool now counts cache hits, prepares, cache clears, and connections opened and retired. Python reports them per pool as `synapse_rust_db_pool_statement_cache_hits_total`, `..._statement_prepares_total`, `..._statement_cache_clears_total`, `..._connections_opened_total` and `..._connections_retired_total`, carried over when the native pool is closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PVLsNh6akt4ifEizY4D1ta