14

Since in this mode pgbouncer creates outbound connection for each inbound connection it seems to me that pgbouncer doesn't work as pooler. It's just 1 to 1 mapping.

Where am I wrong?

Colin 't Hart
  • 9,455
  • 15
  • 36
  • 44
skaurus
  • 243
  • 1
  • 2
  • 5

1 Answers1

23

There would be 1 connection to the server for each connection to pgbouncer, but not necessarily a new connection. When a connection to pgbouncer is closed it doesn't close the connection to the server, just makes that connection available to the pool. Then when a new connection comes in, that pooled connection can be reused.

If the connections to pgbouncer are generally long-lived ones, this might not be of much benefit. But, if there are a lot of short connections, it could result in a major improvement.

There was an excellect blog post published recently about pgbouncer, and the different modes of operation.

qqx
  • 501
  • 4
  • 5