I'm having trouble finding a good summary of the advantages/disadvantages of using pgbouncer for transaction pooling vs session pooling.
Does it mean that a transaction heavy workload is somehow better load balanced? Is it to prevent as many connections being required to connect from pgbouncer to the database?
PgBouncer allows you to easily set up a connection pool that keeps your database performative, while also managing the connections between your applications and PostgreSQL.
And below there are 3 reasons why it is be used. It reduces PostgreSQL resource consumption (memory, backends, fork). It supports online restart/upgrade without dropping client connections. It allows PostgreSQL restart/upgrade without dropping client connections.
Pooling Transaction means an acquisition of the Company in a transaction which is intended to be treated as a "pooling of interests" under generally accepted accounting principles.
There are quite a few pool settings for PgBouncer . For example, here are five common settings: pool_size — Just like it sounds: the size of the pool. The default is 20. For Heroku server-side plans, the default is half of your plan's connection limit.
Transaction-level pooling will help if you have apps that hold idle sessions. PgBouncer won't need to keep sessions open and idle, it just grabs one when a new transaction is started. Those idle sessions only cost you a pgbouncer connection, not a real idle Pg session with a backend sitting around wasting memory & synchronisation overhead doing nothing.
The main reason you'd want session pooling instead of transaction pooling is if you want to use named prepared statements, advisory locks, listen/notify, or other features that operate on a session level not a transaction level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With