Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSBRx-00BwHz-MG for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jan 2024 07:44:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rSBRw-00AYN3-Mf for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jan 2024 07:44:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSBRw-00AYMu-Cz for pgsql-hackers@lists.postgresql.org; Tue, 23 Jan 2024 07:44:00 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSBRq-002vPV-R7 for pgsql-hackers@lists.postgresql.org; Tue, 23 Jan 2024 07:43:58 +0000 Received: from [192.168.1.115] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4TJzc75HmTzyNX; Tue, 23 Jan 2024 09:43:51 +0200 (EET) Message-ID: <7c72475a-9ecc-4240-8c11-73a868a5b46f@iki.fi> Date: Tue, 23 Jan 2024 09:43:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Multiple startup messages over the same connection Content-Language: en-US To: Vladimir Churyukin , pghackers References: From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. -- Heikki Linnakangas Neon (https://neon.tech)