Re: Feature Proposal: Connection Pool Optimization - Change the Connection User

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Todd Hubers <todd(dot)hubers(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Feature Proposal: Connection Pool Optimization - Change the Connection User
Date: 2021-11-22 10:22:05
Message-ID: 57D69304-4520-4A6B-BE51-39294C6A3A43@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 21 Nov 2021, at 03:05, Todd Hubers <todd(dot)hubers(at)gmail(dot)com> wrote:

> 10) Tom said: "How would this interact with the "on login" triggers that people keep asking for?
>
> That's a good point. I would imagine that SET ROLE (which is currently unsuitable) would have the same requirement. The answer is Shared Functions. SET ROLE calls a function like "SetSessionUserId". Our implementation should call the same function(s). If OnLogin functionality is implemented they should trigger from there.

I think thats conflating session_user and current_user, SET ROLE is not a login
event. This is by design and discussed in the documentation:

"SET ROLE does not process session variables as specified by the role's
ALTER ROLE settings; this only happens during login."

The current patch proposal doesn't fire the login event trigger on SET ROLE,
only on actual logins. That patch needs more review before landing, but I'm
not sure tying it to SET ROLE is a good idea.

> 13. Tom said: "I wonder how we test such a feature meaningfully without incorporating a pooler right into the Postgres tree."
>
> We can benchmark without a pooler - see the Benchmark section for details. (Furthermore, I propose that general benchmark tooling does belong in Postgres for the benefit of the ecosystem of connection poolers. I have included such a remark in the Benchmarking section "PostgreSQL is not planning to incorporate Connection Pooling...".)

We might be talking about the same things using different words, but it's
important to remember that we need to cover the functionality in terms of
*tests* first, performance benchmarking is another concern.

--
Daniel Gustafsson https://vmware.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-11-22 10:47:31 Re: pg_get_publication_tables() output duplicate relid
Previous Message Peter Eisentraut 2021-11-22 10:21:52 Re: Some RELKIND macro refactoring