Re: Built-in connection pooler - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Re: Built-in connection pooler
Date
Msg-id fdbf1761-c904-d987-0d01-1cfc8fca703f@postgrespro.ru
Whole thread Raw
In response to Re: Built-in connection pooler  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Built-in connection pooler  (Jaime Casanova <jaime.casanova@2ndquadrant.com>)
List 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 
var=".
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: http://www.postgrespro.com
The Russian Postgres Company


Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Zedstore - compressed in-core columnar storage
Next
From: Etsuro Fujita
Date:
Subject: Useless bms_free() calls in build_child_join_rel()