Re: Built-in connection pooler

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Ryan Lambert <ryan(at)rustprooflabs(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Dimitri Fontaine <dim(at)tapoueh(dot)org>
Subject: Re: Built-in connection pooler
Date: 2019-08-15 11:01:26
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 30.07.2019 16:12, Tomas Vondra wrote:
> On Tue, Jul 30, 2019 at 01:01:48PM +0300, Konstantin Knizhnik wrote:
>> On 30.07.2019 4:02, Tomas Vondra wrote:
>>> My idea (sorry if it wasn't too clear) was that we might handle some
>>> cases more gracefully.
>>> For example, if we only switch between transactions, we don't quite
>>> care
>>> about 'SET LOCAL' (but the current patch does set the tainted flag).
>>> The
>>> same thing applies to GUCs set for a function.
>>> For prepared statements, we might count the number of statements we
>>> prepared and deallocated, and treat it as 'not tained' when there
>>> are no
>>> statements. Maybe there's some risk I can't think of.
>>> The same thing applies to temporary tables - if you create and drop a
>>> temporary table, is there a reason to still treat the session as
>>> tained?

I have implemented one more trick reducing number of tainted backends:
now it is possible to use session variables in pooled backends.

How it works?
Proxy determines "SET var=" statements and  converts them to "SET LOCAL
Also all such assignments are concatenated and stored in session context
at proxy.
Then proxy injects this statement inside each transaction block or
prepend to standalone statements.

This mechanism works only for GUCs set outside transaction.
By default it is switched off. To enable it you should switch on
"proxying_gucs" parameter.

Konstantin Knizhnik
Postgres Professional:
The Russian Postgres Company

Attachment Content-Type Size
builtin_connection_proxy-19.patch text/x-patch 124.4 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-08-15 11:31:24 Useless bms_free() calls in build_child_join_rel()
Previous Message Heikki Linnakangas 2019-08-15 10:05:49 Re: Zedstore - compressed in-core columnar storage