Re: Multiple startup messages over the same connection

From: Vladimir Churyukin <vladimir(at)churyukin(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: pghackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Multiple startup messages over the same connection
Date: 2024-01-23 21:51:04
Message-ID: CAFSGpE1Lnr-VJG-RER=otS+rMJzB2-GtuQSZNfGmUZ-k1nt-9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 22, 2024 at 11:43 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:

> On 22/01/2024 21:58, Vladimir Churyukin wrote:
> > A question about protocol design - would it be possible to extend the
> > protocol, so it can handle multiple startup / authentication messages
> > over a single connection? Are there any serious obstacles? (possible
> > issues with re-initialization of backends, I guess?)
> > If that is possible, it could improve one important edge case - where
> > you have to talk to multiple databases on a single host currently, you
> > need to open a separate connection to each of them. In some cases
> > (multitenancy for example), you may have thousands of databases on a
> > host, which leads to inefficient connection utilization on clients (on
> > the db side too). A lot of other RDBMSes don't have this limitation.
>
> The protocol and the startup message are the least of your problems.
> Yeah, it would be nice if you could switch between databases, but the
> assumption that one backend operates on one database is pretty deeply
> ingrained in the code.

Yes, I suspected that's the reason why it was not implemented so far,
but what's the main problem there?
Is the issue with the global data cleanup / re-initialization after the
database is changed?
Is it in 3rd party extensions that assume the same and may break?
Anything else?

-Vladimir Churyukin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-01-23 21:52:24 Re: On login trigger: take three
Previous Message Tristan Partin 2024-01-23 21:50:11 Re: Remove pthread_is_threaded_np() checks in postmaster