An exciting PGBouncer release: “The one with prepared statements”.

Prepared statements have always been a problem for PGBouncer because they’re prepared at the level of a session rather than shared in the database across connections. PGBouncer attains its multiplexing capabilities by mapping “virtual” sessions to “real” Postgres sessions, so there wouldn’t be any guarantee after a statement had been prepared that a subsequent attempt to use it would go the original session.

The new version of PGBouncer solves the problem via internal bookkeeping where PGBouncer itself becomes prepared statement aware. If an incoming use of a prepared statement would go to an underlying connection where it hasn’t been prepared yet, that gets taken care of first.

The release notes claim a performance improvement between 15% to 250%. I’d guess that it’d be closer to 15% for most real world apps, but if you’re using PGBouncer, why not. It’s still 15%.

We’ll have it ready on Bridge soon. (Update: now available.)

View all atoms ⭢