Diagnostic step 1
Collect concurrent activity traces (pg_stat_activity, pg_locks) during a hang, noting transaction start times, xmin, and query texts; do this non-invasively and avoid killing sessions until analysis is complete.
Generated Oct 3, 2026, 12:35:03 AM
Collect concurrent activity traces (pg_stat_activity, pg_locks) during a hang, noting transaction start times, xmin, and query texts; do this non-invasively and avoid killing sessions until analysis is complete.
Enable pg_stat_statements temporarily to identify frequently prepared statements that are executed within long-lived transactions.
Introduce or tighten idle_in_transaction_session_timeout and statement_timeout for suspicious connection pools to fail stuck operations quickly while monitoring impact.
Audit application logic to ensure transactions in SERIALIZABLE mode do not remain open across user think-time; prefer short transactions or switch to READ COMMITTED for operations that will later acquire FOR UPDATE.
If prepared-statement plan caching is suspected, test disabling server-side prepared statements in the client library or use PREPARE/EXECUTE with new statements per transaction in a staging environment; escalate to DBA/architect if behavior persists.