Question

I'm testing the pgbouncer "pause" feature to minimize database downtime when a database restart is required.

For this test, I have a remote psql session connected to my database through pgbouncer. Pgbouncer SHOW CLIENTS shows my remote session as Active even with no queries running. The same client shows Idle according to pg_stat_activity. When I issue the PAUSE command, it hangs until I close my remote session. Shouldn't PAUSE work without closing my connection?

Was it helpful?

Solution

At least with pool_mode=session, it looks like a 'PAUSE' command will succeed only if the other client(s) have not yet issued any queries in their sessions. If the other client(s) have already issued any queries, the 'PAUSE;' command hangs as you describe.

This basically makes sense from PgBouncer's point of view, as it doesn't need to give a real connection to a client before the client issues any queries, but once it does a 'PAUSE' must wait for that client to finish its session.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top