Great addition, and a sneaky one, because the pool looks healthy while one slow endpoint holds a backend hostage. Agree on setting idle_in_transaction_session_timeout as the backstop. The real fix is usually moving the API call or queue publish outside the transaction, but the timeout catches the paths nobody remembers. Your pg_stat_activity query is the first thing I'd run too.