Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q70qV-0003Vy-3E for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jun 2023 21:37:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q70qT-00023X-VK for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Jun 2023 21:37:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q70qT-00023A-L6 for pgsql-hackers@lists.postgresql.org; Wed, 07 Jun 2023 21:37:33 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q70qJ-000ttV-FJ; Wed, 07 Jun 2023 21:37:33 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B1D565C01A1; Wed, 7 Jun 2023 17:37:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 07 Jun 2023 17:37:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1686173842; x=1686260242; bh=6C EUbAnZhS92r6jO+O+2huFpduT2wlFpx0GqQZpJkLs=; b=gIUSY5Pj0nYV9avCgk IA4B5UJ6okF67ASd5jDP+rZAgzk7iRNgIfRqruaRlxmBoSI2Z7mjYpUSciGxcP8a yZ2mkDNl8c6C2tc4G6dcB1EPM9vGE5scMXFPptTLK+GY8QYvGIeh2/J2PczkpO9L 9YUdLhMyczhIo037RklusMRp54NFzj5RVEBo3Xqx4MDNFj6KKGtaBGXduYT7qFdZ QHsIS1rhNDAtC7QbPDd191bVXv+gUml1FJpCNpZP7xkODwQ8LiWNXnz/fHeAwBKo Q/AwEoGMkFo/zQDI3/MAmxi5bW3gby5mFr5xflFK/gpsC/a7RWlmdjVzUYS8AkDj OmbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1686173842; x=1686260242; bh=6CEUbAnZhS92r 6jO+O+2huFpduT2wlFpx0GqQZpJkLs=; b=rL4l9s59kAE99fR06iqMUdJvjnxFs vgObBdCbcaM08/IrwDHw8zTVNEwqkJa/xV1uqtmy1zv21hD1Ro/d5N+4zCPORVbZ coFlEK90boIJi5x1KvGnsmIJmyLdLoEk5cSvBn2ndB+9uMsRZcA5bwymkb5uaR6Y 3p5XQy/c9/bJDVR5Q+pged6KEgRhtYbz29uJWMQbYoftml3hlM9e8dUvXsTQUS3f fiTISPnaKXqEaVHepf3Bmgn4YF6z2HBR4U9XPUQgruYJcdhCOYWBEJDyBzoopFbN ICfGcLjRprMCXp9uq3UugHNemVU4vwvZ932Y+odrlVoYgrZn347l7I6cA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtgedgudeifecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 7 Jun 2023 17:37:22 -0400 (EDT) Date: Wed, 7 Jun 2023 14:37:21 -0700 From: Andres Freund To: "Jonathan S. Katz" Cc: Heikki Linnakangas , Tom Lane , pgsql-hackers Subject: Re: Let's make PostgreSQL multi-threaded Message-ID: <20230607213721.al3etgcgtija3ytz@awork3.anarazel.de> References: <31cc6df9-53fe-3cd9-af5b-ac0d801163f4@iki.fi> <4178104.1685978307@sss.pgh.pa.us> <4ce6c0f8-e8a4-1672-93fd-49d3fa975ee5@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-06-05 13:40:13 -0400, Jonathan S. Katz wrote: > 2. While I wouldn't want to necessarily discourage a moonshot effort, I > would ask if developer time could be better spent on tackling some of the > other problems around vertical scalability? Per some PGCon discussions, > there's still room for improvement in how PostgreSQL can best utilize > resources available very large "commodity" machines (a 448-core / 24TB RAM > instance comes to mind). I think we're starting to hit quite a few limits related to the process model, particularly on bigger machines. The overhead of cross-process context switches is inherently higher than switching between threads in the same process - and my suspicion is that that overhead will continue to increase. Once you have a significant number of connections we end up spending a *lot* of time in TLB misses, and that's inherent to the process model, because you can't share the TLB across processes. The amount of duplicated code we have to deal with due to to the process model is quite substantial. We have local memory, statically allocated shared memory and dynamically allocated shared memory variants for some things. And that's just going to continue. > I'm purposely giving a nonanswer on whether it's a worthwhile goal, but > rather I'd be curious where it could stack up against some other efforts to > continue to help PostgreSQL improve performance and handle very large > workloads. There's plenty of things we can do before, but in the end I think tackling the issues you mention and moving to threads are quite tightly linked. Greetings, Andres Freund