<story><title>PostgreSQL 16 Beta 1</title><url>https://www.postgresql.org/about/news/postgresql-16-beta-1-released-2643/</url></story><parent_chain><item><author>Nextgrid</author><text>Out of curiosity, if the problem of connections being expensive is solvable by PGBouncer-style connection multiplexing, why doesn&amp;#x27;t Postgres just do that by itself?</text></item><item><author>dalyons</author><text>IMO the biggest reason folks use pgbouncer is not for load balancing (which it can do, -ish) but instead for connection pooling. Postgres connections are expensive for the db server (one process per connection not one thread) so if you have say thousands of web application pods you need to use pgbouncer or similar as a proxy to multiplex those thousands of connections down onto a more manageable number (~200). So no, not really.&lt;p&gt;(EDIT: if you don&amp;#x27;t know this already - the _establishment_ of connections is also super expensive. so another reason to pgbounce is to keep connections persistent if you have app servers that are constantly opening and closing conns, or burst open conns, or such like. Even if the total conns to pg doesnt go super high, the cost of constantly churning them can really hurt your db)</text></item><item><author>Fgehono</author><text>Could you elaborate on the load balancing?&lt;p&gt;Is this a replacement for PG bouncer and similar?</text></item><item><author>craigkerstiens</author><text>For being &amp;quot;boring and stable&amp;quot; technology, Postgres 16 includes 200 features, which is on par with each of prior years releases. If you&amp;#x27;re looking for the full set of features it&amp;#x27;s available here - &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.postgresql.org&amp;#x2F;docs&amp;#x2F;16&amp;#x2F;release-16.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.postgresql.org&amp;#x2F;docs&amp;#x2F;16&amp;#x2F;release-16.html&lt;/a&gt;.&lt;p&gt;Personal favorites on the list include:&lt;p&gt;- load_balance_hosts, which is an improvement to libpq so you can load balance across multiple Postgres instances.&lt;p&gt;- Logical replication on standbys&lt;p&gt;- pg_stat_io which is a new view that shows IO details.</text></item></parent_chain><comment><author>anarazel</author><text>If it were easy to do well in-core, I think we&amp;#x27;d do it immediately. Unfortunately the interesting pooling modes in pgbouncer also break a few things - which would likely not be acceptable in core postgres. Avoiding such breakage requires non-trivial architectural adjustments.&lt;p&gt;Historically connection state and &amp;quot;process state&amp;quot; have been tightly coupled, for good server-side pooling they have to be divorced. While good pooling is doable with the current process model (passing the client file descriptor between processes using SCM_RIGHTS), it&amp;#x27;s much harder with processes than with threads - this is one of the reasons I think we will eventually need to migrate to threads.&lt;p&gt;Eventually I want to get to a point where we have a limited number of &amp;quot;query execution   workers&amp;quot; that handle query execution, utilized by a much larger number of client connections (which do not have dedicated threads each). Obviously it&amp;#x27;s a long way to go to that.  Ah, the fun working on an complicated application with a ~35 year history.&lt;p&gt;There also are use cases for pgbouncer that cannot be addressed on the server-side - one important one is to run pgbouncer on &amp;quot;application servers&amp;quot;, to reduce the TCP+TLS connection establishment overhead and to share connections between application processes &amp;#x2F; threads. That can yield very substantial performance gains - completely independent of server side pooling support.</text></comment>
<story><title>PostgreSQL 16 Beta 1</title><url>https://www.postgresql.org/about/news/postgresql-16-beta-1-released-2643/</url></story><parent_chain><item><author>Nextgrid</author><text>Out of curiosity, if the problem of connections being expensive is solvable by PGBouncer-style connection multiplexing, why doesn&amp;#x27;t Postgres just do that by itself?</text></item><item><author>dalyons</author><text>IMO the biggest reason folks use pgbouncer is not for load balancing (which it can do, -ish) but instead for connection pooling. Postgres connections are expensive for the db server (one process per connection not one thread) so if you have say thousands of web application pods you need to use pgbouncer or similar as a proxy to multiplex those thousands of connections down onto a more manageable number (~200). So no, not really.&lt;p&gt;(EDIT: if you don&amp;#x27;t know this already - the _establishment_ of connections is also super expensive. so another reason to pgbounce is to keep connections persistent if you have app servers that are constantly opening and closing conns, or burst open conns, or such like. Even if the total conns to pg doesnt go super high, the cost of constantly churning them can really hurt your db)</text></item><item><author>Fgehono</author><text>Could you elaborate on the load balancing?&lt;p&gt;Is this a replacement for PG bouncer and similar?</text></item><item><author>craigkerstiens</author><text>For being &amp;quot;boring and stable&amp;quot; technology, Postgres 16 includes 200 features, which is on par with each of prior years releases. If you&amp;#x27;re looking for the full set of features it&amp;#x27;s available here - &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.postgresql.org&amp;#x2F;docs&amp;#x2F;16&amp;#x2F;release-16.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.postgresql.org&amp;#x2F;docs&amp;#x2F;16&amp;#x2F;release-16.html&lt;/a&gt;.&lt;p&gt;Personal favorites on the list include:&lt;p&gt;- load_balance_hosts, which is an improvement to libpq so you can load balance across multiple Postgres instances.&lt;p&gt;- Logical replication on standbys&lt;p&gt;- pg_stat_io which is a new view that shows IO details.</text></item></parent_chain><comment><author>dingledork69</author><text>Because pgbouncer&amp;#x27;s transaction-based pooling, which is what the previous poster was referring to, breaks a few postgres features. This is fine for most applications, but not all. See the table on &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.pgbouncer.org&amp;#x2F;features.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.pgbouncer.org&amp;#x2F;features.html&lt;/a&gt;</text></comment>