Poisoned Postgres connection pools
Summary
Poisoned Postgres connection pools explains how pooled connections can end up with stale or session-level state that poison subsequent queries, leading to errors like cannot execute INSERT in a read-only transaction. The article describes PgBouncer in transaction mode, symptoms, diagnostics via PlanetScale Insights, and practical antidotes including DISCARD ALL, killing problematic sessions, and using PlanetScale MCP to identify root causes and fix code paths that modify session state. It also covers preventative strategies such as replica routing and proper timeouts.