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 1q7D1T-0000el-Gz for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Jun 2023 10:37:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q7D1R-0006vM-So for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Jun 2023 10:37:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7D1R-0006tF-I0 for pgsql-hackers@lists.postgresql.org; Thu, 08 Jun 2023 10:37:41 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q7D1O-000sQZ-Jp for pgsql-hackers@lists.postgresql.org; Thu, 08 Jun 2023 10:37:40 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-514924ca903so643901a12.2 for ; Thu, 08 Jun 2023 03:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1686220657; x=1688812657; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=i1U/XLr561dKncF/5yYJFuktcNUDi96rSym0jf/9flI=; b=C+kxdVsGSm7wMrWSyiGZgqZyqCVDidY1gT1OENV7SjiAcVPTuWXMTq2cc/IRO/lTu+ llkxmfXKLK4TUfWygmcX/z/fe/KvuUJi48mGyj6bC7+orUJI8DrW7DTAsVDNlX5kLBdV bTVDvKA4GrX6vQxbTwG1KCdFK9tryccUgc3xvBitFWQcNUnJSGUC2pXIodI7zmsWQsWv KhsV1DtudAPFcpMghWxsd6GZhWMM9RvDzm43r0jp92z98h++ujGSVehPqf8FE56mEbdN PUtHVC5+sVgMIraf58e9ijJk8tXGV+uOsHXImYEKx1e130jPFYHcn9NlCbjxmLpFNRVB K1hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686220657; x=1688812657; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i1U/XLr561dKncF/5yYJFuktcNUDi96rSym0jf/9flI=; b=RnLyE82MRLwMnraO7YodDSQfNrK/Z5JScj3rk9VVCj/53KNlHZM1bX/vOAsduV/eW+ kbzIgvLkc5hS3xUNJps5PG0p8P1+f5OWFiAj3e9gXQeY6qRuS5DKR48XDu9y1mG2C4Xd srGujLOCLvPRQ2AC/EbzqoBZn87s1lTKsPaKbzMs289tk+vmaBO33Fs/EoqPfufsEuO5 +ea6bh8tjNzU/linZo3ulw/ujE7FgbHDdPOVyaIwv03VHHD/y7ebkc0lKWZe81eIZAm0 FfAELmotZgYLImoDaU6ffO88FKH4WXC3PUOqDsh7JIUfLCUvz5GJ3bfqgpwGI5FrQjYq N2LA== X-Gm-Message-State: AC+VfDwPRTOxNqGxTqVyy9JqkPLEim551PG7PlIWQMpesirySTvl8JDO /KgnYFB9+QK1sctaVD5bIrjf+nB5adnRbSQJJXg= X-Google-Smtp-Source: ACHHUZ7KWd16QF2dYzkAnkqGjB0mMsXW475QxqJlh3eayAowEaS11ti9b4tUoypZ9kBAvVm1KN3UcA== X-Received: by 2002:a05:6402:180b:b0:514:9e81:9070 with SMTP id g11-20020a056402180b00b005149e819070mr6047348edy.15.1686220657058; Thu, 08 Jun 2023 03:37:37 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id i16-20020aa7c9d0000000b0050d83a39e6fsm395643edt.4.2023.06.08.03.37.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jun 2023 03:37:36 -0700 (PDT) Message-ID: <3d8ffaa5-b9a1-9538-9ac3-ffa751449f4b@enterprisedb.com> Date: Thu, 8 Jun 2023 12:37:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Let's make PostgreSQL multi-threaded Content-Language: en-US To: Thomas Munro , Jeremy Schneider Cc: pgsql-hackers@lists.postgresql.org, Thomas Kellerer , Heikki Linnakangas , Tom Lane References: <31cc6df9-53fe-3cd9-af5b-ac0d801163f4@iki.fi> <4178104.1685978307@sss.pgh.pa.us> <4ce6c0f8-e8a4-1672-93fd-49d3fa975ee5@iki.fi> <29fe5f48-a6ed-d896-45ed-16b5904353a9@enterprisedb.com> <41c1e20d-f179-f87e-5929-80ca9ee0c105@gmx.net> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/8/23 01:37, Thomas Munro wrote: > On Thu, Jun 8, 2023 at 10:37 AM Jeremy Schneider > wrote: >> On 6/7/23 2:39 PM, Thomas Kellerer wrote: >>> Tomas Vondra schrieb am 07.06.2023 um 21:20: >>>> Also, which other projects did this transition? Is there something we >>>> could learn from them? Were they restricted to much smaller list of >>>> platforms? >>> >>> Not open source, but Oracle was historically multi-threaded on Windows >>> and multi-process on all other platforms. >>> I _think_ starting with 19c you can optionally run it multi-threaded on >>> Linux as well. >> Looks like it actually became publicly available in 12c. AFAICT Oracle >> supports both modes today, with a config parameter to switch between them. > > It's old, but this describes the 4 main models and which well known > RDBMSes use them in section 2.3: > > https://dsf.berkeley.edu/papers/fntdb07-architecture.pdf > > TL;DR DB2 is the winner, it can do process-per-connection, > thread-per-connection, process-pool or thread-pool. > I think the basic architectures are known, especially from the user perspective. I'm more interested in challenges the projects faced while moving from one architecture to the other, or how / why they support more than just one, etc. In [1] Heikki argued that: I don't think this is worth it, unless we plan to eventually remove the multi-process mode. ... As long as you need to also support processes, you need to code to the lowest common denominator and don't really get the benefits. But these projects clearly support multiple architectures, and have no intention to ditch some of them. So how did they do that? Surely they think there are benefits. One option would be to just have separate code paths for processes and threads, but the effort required to maintain and improve that would be deadly. So the only feasible option seems to be they managed to abstract the subsystems enough for the "regular" code to not care about model. [1] https://www.postgresql.org/message-id/6e3082dc-ff29-9cbf-847e-5f570828b46b@iki.fi > I understand this thread to be about thread-per-connection (= backend, > session, socket) for now. Maybe, although people also proposed to switch the parallel query to threads (so that'd be multiple threads per session). But I don't think it really matters, the concerns are mostly about moving from one architecture to another and/or supporting both. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company