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 1lOm0m-0002XP-7N for pgsql-committers@arkaria.postgresql.org; Tue, 23 Mar 2021 18:44:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lOm0k-0007z9-Sk for pgsql-committers@arkaria.postgresql.org; Tue, 23 Mar 2021 18:44:14 +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 1lOm0k-0007yz-0Y for pgsql-committers@lists.postgresql.org; Tue, 23 Mar 2021 18:44:14 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lOm0h-0005QU-2U for pgsql-committers@lists.postgresql.org; Tue, 23 Mar 2021 18:44:12 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 14DD45C00A2; Tue, 23 Mar 2021 14:44:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 23 Mar 2021 14:44:09 -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=BwWthPpd05wvfkQaY0afNk66GVV l1poKwjRqRv/Jm5I=; b=kf+6F9mS7rk+EIpHjqw6ZzCPT8aAINMx9/m3Z+VcyQo aYExzGP4NL/PObEyokXRDoHsAbiNEQosTse53PhXNUjY7vpleWDJqzM9NMWu1Amm ZK+7w7Zg16TiK7uW53zI9EE4awCV7ImnRrH8+Ep1dt/Kh0Pmp8Rbg8Tsjv8ZvWFI 68f1bZ/2IHvLodozvTpqh5dIJ729m9Vl3wLFb0jYwWJ1dPX/wfCZbeKa8FCGlb6W HxChv+1BU0i13jzCNMne6IhwSvNb9FkWUHM7hOEKczr2k5zpkVeZYpa+grsXl7DT And/AjuT7CrixEK6c2CplR36SK61hUXS9Fh5T53ZCfw== 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=BwWthP pd05wvfkQaY0afNk66GVVl1poKwjRqRv/Jm5I=; b=vYdpZ9uIiEd7nfJRjw4Bk9 FtxsZl5ZbxyZLuuf1RiVslB+XQHukKI/QpphkYtedZnQwsvIjkCOjj6qXj1IwSsZ SC5zckJNez344Xy85ZZwXU+atlY5K/zYbEmUL8yQNaghuy1SYQuK5ZI2xxXcTFic D7VfYFxb+YBHlxLCDgXPKBzS5D7/CinnojfzgNuj4UHSsriEAMTmcz3rSw9wNXbQ l8Nt0KoIM01IWytEVMIBJTklHn6Ffm2dIwXyjmtO6MEzSNbFuC3mZbsiv5PV5pmU nq6QK5bQDvpqFwkyVCTzIJxSuB2N3wvJBN14SPl1W3t5nmkrStcWZ0Pa7wZ+1yWA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegiedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepffdvvdevleelgffhheeitdevhfefgfeivdevieeltdffkeefgffguedt keeiheejnecuffhomhgrihhnpehpohhsthhgrhdrvghsnecukfhppeeijedrudeitddrvd dujedrvdehtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg 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 3EF34108005C; Tue, 23 Mar 2021 14:44:08 -0400 (EDT) Date: Tue, 23 Mar 2021 11:44:06 -0700 From: Andres Freund To: Robert Haas Cc: Amit Kapila , pgsql-committers Subject: Re: pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode Message-ID: <20210323184406.fv7jh5j722ala5lz@alap3.anarazel.de> References: 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-22 08:47:47 -0400, Robert Haas wrote: > I find this fairly ugly. If you can't make the cost of checking > whether parallelism is safe low enough that you don't need a setting > for this, then I think perhaps you shouldn't have the feature at all. > In other words, I propose that you revert both this and 05c8482f7f and > come back when you have a better design that doesn't introduce so much > overhead. I started out wondering whether some of the caching David Rowley has been working on to reduce the overhead of the result cache planning shows a path for how to make parts of this cheaper. https://postgr.es/m/CAApHDvpw5qG4vTb%2BhwhmAJRid6QF%2BR9vvtOhX2HN2Yy9%2Bw20sw%40mail.gmail.com But looking more, several of the checks just seem wrong to me. target_rel_index_max_parallel_hazard() deparses index expressions from scratch? With code like + index_rel = index_open(index_oid, lockmode); ... + index_oid_list = RelationGetIndexList(rel); + foreach(lc, index_oid_list) ... + ii_Expressions = RelationGetIndexExpressions(index_rel); ... + Assert(index_expr_item != NULL); + if (index_expr_item == NULL) /* shouldn't happen */ + { + elog(WARNING, "too few entries in indexprs list"); + context->max_hazard = PROPARALLEL_UNSAFE; + found_max_hazard = true; + break; + } Brrr. Shouldn't we have this in IndexOptInfo already? But also, why on earth is that WARNING branch a good idea? +static bool +target_rel_domain_max_parallel_hazard(Oid typid, max_parallel_hazard_context *context) ... + scan = systable_beginscan(con_rel, ConstraintTypidIndexId, true, + NULL, 1, key); + + while (HeapTupleIsValid((tup = systable_getnext(scan)))) There's plenty other code in the planner that needs to know about domains. This stuff is precisely why the typecache exists. The pattern to rebuild information that we already have cached elsewhere seems to repeat all over this patch. This seems not even close to committable. Greetings, Andres Freund