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 1q7J2E-0006iO-5T for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Jun 2023 17:02:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q7J2D-00037r-0r for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Jun 2023 17:02:53 +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 1q7J2C-00037h-No for pgsql-hackers@lists.postgresql.org; Thu, 08 Jun 2023 17:02:52 +0000 Received: from tzirechnoy.static.corbina.ru ([78.107.237.199] helo=mail.mednm.com) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1q7J2A-0013iz-1f for pgsql-hackers@postgresql.org; Thu, 08 Jun 2023 17:02:52 +0000 Received: from mail.tzirechnoy.ru (unknown [85.143.106.93]) by mail.mednm.com (Postfix) with ESMTPSA id E6D4E1010A90; Thu, 8 Jun 2023 20:02:48 +0300 (MSK) Received: by mail.tzirechnoy.ru (Postfix, from userid 1000) id E29A8A42D6; Thu, 8 Jun 2023 20:02:46 +0300 (MSK) Date: Thu, 8 Jun 2023 20:02:46 +0300 From: Ilya Anfimov To: pgsql-hackers@lists.postgresql.org, pgsql-hackers Subject: Re: Let's make PostgreSQL multi-threaded Message-ID: Mail-Followup-To: Ilya Anfimov , pgsql-hackers@lists.postgresql.org, pgsql-hackers References: <31cc6df9-53fe-3cd9-af5b-ac0d801163f4@iki.fi> <4178104.1685978307@sss.pgh.pa.us> <31ec84ad-c10c-9351-bf9f-19679c832b73@dunslane.net> 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 On Wed, Jun 07, 2023 at 10:26:07AM +1200, Thomas Munro wrote: > On Tue, Jun 6, 2023 at 6:52???AM Andrew Dunstan wrote: > > If we were starting out today we would probably choose a threaded implementation. But moving to threaded now seems to me like a multi-year-multi-person project with the prospect of years to come chasing bugs and the prospect of fairly modest advantages. The risk to reward doesn't look great. > > > > That's my initial reaction. I could be convinced otherwise. > > Here is one thing I often think about when contemplating threads. > Take a look at dsa.c. It calls itself a shared memory allocator, but > really it has two jobs, the second being to provide software emulation > of virtual memory. That???s behind dshash.c and now the stats system, > and various parts of the parallel executor code. It???s slow and > complicated, and far from the state of the art. I wrote that code > (building on allocator code from Robert) with the expectation that it > was a transitional solution to unblock a bunch of projects. I always > expected that we'd eventually be deleting it. When I explain that > subsystem to people who are not steeped in the lore of PostgreSQL, it > sounds completely absurd. I mean, ... it is, right? My point is Isn't all the memory operations would require nearly the same shared memory allocators if someone switches to a threaded imple- mentation? > that we???re doing pretty unreasonable and inefficient contortions to > develop new features -- we're not just happily chugging along without > threads at no cost. >