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 1lOvRq-0000hu-Fi for pgsql-committers@arkaria.postgresql.org; Wed, 24 Mar 2021 04:48:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOvRp-0002Uj-CA for pgsql-committers@arkaria.postgresql.org; Wed, 24 Mar 2021 04:48:49 +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 1lOvRo-0002Uc-CX for pgsql-committers@lists.postgresql.org; Wed, 24 Mar 2021 04:48:49 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOvRl-0001if-5x for pgsql-committers@lists.postgresql.org; Wed, 24 Mar 2021 04:48:47 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 734C5F57; Wed, 24 Mar 2021 00:48:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 24 Mar 2021 00:48:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=Y2c/nxBGzCRmCsgzMVa/2cSVVsM v0gD2BUc7AlX2EE8=; b=bo6C5RYKBP6J0/XaSJtkEiIt5cx8nTFFa//kTsfofZk avm6Awl9l8K6tbYt8QYst4nSLw4DudFM5GK62MM2OIko0rxcqvcdA1y8atUTSQY9 +DAy0Qc6CxXy9dzrQmN9H0Ms6hW33l0P6TpUcEiacqd4zlDEyOxrbgZaaVaoQlRX PuB04hGpgAJkMdrSTOWNMP8GNxTWSH6Yz0y3y4b0wEr1rPRz+GW557n/+v+iR/J+ bxN5Y8xS/F/vcpmDxWeklIeF0/DZmKNT9QQhSLGNtKVtIN0ZWp4x/ibgnMl0YVdt dc8Gf4h/mI0H7vLTd2HaMWcWx3z0Ca7nDd0pnivkerA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Y2c/nx BGzCRmCsgzMVa/2cSVVsMv0gD2BUc7AlX2EE8=; b=ZXtLmjeCIh8CNUDei6BIf9 32XkjGy3WJEeJC5sVnkoloo0aqZ9pb/8sT35xU9kL7bk6sI0i9rFj1sj7HrIEimp sec9xDQD2+NYemTCVW2g8AfWqfHsxKdCfJEyq9sg+DzzMMxDoWgNdgBMQaV7a34L 8DulhDdG9b9FN/Kwj4YTKgS0ICvxnBSHMd/Z/8Y9l5fC4EHAIpi4EVTEQLc7nick kbREQOR2EejNFnO6HouaHBRT7Ze4xpTgRdcyApre05VRKyBSclPhAAxOEotUbs6F V5Ftxw/MboRVa7F0PfyrZYtya3TeKou0nyNQvVerZOvhVrg3vkEkOdMuMIHNje0g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegjedgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucfkphepieejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdr uggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id 5280A1080057; Wed, 24 Mar 2021 00:48:42 -0400 (EDT) Date: Tue, 23 Mar 2021 21:48:40 -0700 From: Andres Freund To: Robert Haas Cc: Amit Kapila , Tom Lane , Amit Kapila , pgsql-committers Subject: Re: pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode Message-ID: <20210324044840.ed65i3w7prlssfmd@alap3.anarazel.de> References: <558385.1616423602@sss.pgh.pa.us> <20210323191307.twhewx7vqj2ocglv@alap3.anarazel.de> 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 2021-03-23 16:04:59 -0400, Robert Haas wrote: > It would be easy enough to set a flag in the relcache whose value is > computed the first time we need it and is then consulted every time > after that, and you just invalidate it based on sinval messages. But, > if you go with that design, you've got a big problem: now an insert > has to lock all the tables in the partitioning hierarchy to decide > whether it can run in parallel or not, and we do not want that. We > want to be able to just lock the partitions we need, so really, we > want to be able to test for parallel-safety without requiring a > relation lock, or only requiring it on the partitioned table itself > and not all the partitions. That seems like an argument for a pg_class attribute about parallel safety of the current relation *and* its children. It'd definitely mean recursing higher in the partition tree during DDL if the action on a child partition causes the safety to flip. > But if I had thought about it and had not come up with anything better > than what you committed here, I would have committed nothing, and I > think that's what you should have done, too. I agree with that. > Just to take one example, consider the code that forces a transaction > ID assignment prior to the operation. You *could* have solved this > problem by introducing new machinery to make it safe to assign an XID > in parallel mode. Then, we'd have a fundamental new capability that we > currently lack. Instead, you just force-assigned an XID before > entering parallel mode. That's not building any new capability; that's > just hacking around the lack of a capability to make something work, > while ignoring the disadvantages of doing it that way, namely that > sometimes an XID will be assigned for no purpose. Although this specific hack doesn't seem too terrible to me. If you execute a parallel insert the likelihood to end up not needing an xid is pretty low. Implementing it concurrently does seem like it'd end up needing another lwlock nested around xid assignment, or some more complicated scheme with already holding XidGenLock or retries. But maybe I'm missing an easy solution here. Greetings, Andres Freund