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 1nZNRu-0001M6-6s for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Mar 2022 01:48:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZNRt-0003tN-3j for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Mar 2022 01:48:37 +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 1nZNRr-0003rE-G3 for pgsql-hackers@lists.postgresql.org; Wed, 30 Mar 2022 01:48:36 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZNRp-0002r3-10 for pgsql-hackers@lists.postgresql.org; Wed, 30 Mar 2022 01:48:34 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0A1F85C0138; Tue, 29 Mar 2022 21:48:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 29 Mar 2022 21:48:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc: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; bh=B8KTyX9jvZmTInp7t6mdquxpYjRM+KV2+v+HuQ z+Z5I=; b=M6bgUW5551yGexEG+n6Gl1TjOEDQXt6xV/A+a8c8JKLsel2yRAJDRI uSqSJO4vviXNtKF7oKu730OZK8znHNUmwXtyjhaLvVyoOJxpginVKs1yAu1Zauzd Y49zIIgu7TFYS5uh2Gp38PjTaw+YhlhQ43GV6k83La0d0Y18u1MpFFIP3GDrl2B1 VyGqCTiyKI/jnSm5Rp9Z4lCq4yVtCMcf+Jr/7Nf8npyiB0FID4KwgXezEOxwgITQ 8D9tgMcPnQWuXUu/gy+KX9fJh9dVG6q6NtS/xafrInR4tnLSSLDt8ANX3OS3V2we BsfxrBLKL88t8fEIgaXurP1RUUsCcNYw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date: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=fm3; bh=B8KTyX9jvZmTInp7t 6mdquxpYjRM+KV2+v+HuQz+Z5I=; b=j0quQ02lcWfZqSoGNGA0ycalYGTFqtW9F 3ftRbRoHbjiSgw3jvw6hUcVN8GfV7rh6Te/jsuxyDO974f+qPt1Vneu4spEg2/Ys +gafQMZZDV+U+Bdigg9bWxk+rWJZUsDsiGVbD+kKCmngtDoywZZLUGAPccI6WYyD k3FMkM8dfKzUDFLuYf/OcD4zm0Ph2JRNJ3lIgAEqN/s7u/urxzi9jR5dkjxOSlkj imZ57fhBdDvMaU/tKoc704+/+jdD7I54eTFURGiEOWccE3tfh1QOReVcUc2aB5xp sM79lzX5YndTFqy0COZLbBNwpeOSc2oR94k/saqp8BdvrbfmQH1Rw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudeiuddghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 29 Mar 2022 21:48:31 -0400 (EDT) Date: Tue, 29 Mar 2022 18:48:30 -0700 From: Andres Freund To: David Rowley Cc: Robert Haas , Julien Rouhaud , Magnus Hagander , Justin Pryzby , PostgreSQL Hackers Subject: Re: Add parameter jit_warn_above_fraction Message-ID: <20220330014830.34hrs4hl5ej23h3x@alap3.anarazel.de> References: <20220321235048.wb3ymun6lbi33b2u@alap3.anarazel.de> <20220329100846.3iedk5ear3ewdi5j@jrouhaud> <20220329231641.ai3qrzpdo2vqvwix@alap3.anarazel.de> <20220330002030.fdfopirlsakhsg77@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 2022-03-30 14:30:32 +1300, David Rowley wrote: > On Wed, 30 Mar 2022 at 13:20, Andres Freund wrote: > > I wonder whether it'd make sense to combine that with awareness of a few plan > > types that can lead to large portions of child nodes never being executed. One > > the case where the current behaviour is the worst is runtime partition pruning > > in append - we compile expressions for whole subtrees that will never be > > executed. We should be much more hesitant to compile there compared to a > > cheap-ish node that we know will be executed as part of a large expensive part > > of the plan tree. > > I think that's also a problem but I think that might be better fixed > another way. > > There is a patch [1] around that seems to change things to compile JIT > on-demand. That's a bad idea idea to do on a per-function basis. Emitting functions one by one is considerably slower than doing so in larger chunks. Of course that can be addressed to some degree by something like what you suggest below. > I've not looked at the patch but imagine the overhead might be kept minimal > by initially setting the evalfunc to compile and run, then set it to just > run the compiled Expr for subsequent executions. That part I'm not worried about, there's such an indirection on the first call either way IIRC. > Maybe nodes below an Append/MergeAppend with run-time pruning could compile > on-demand and other nodes up-front. Or maybe there's no problem with making > everything on-demand. Yea, that could work. The expressions for one "partition query" would still have to be emitted at once. For each such subtree we should make a separate costing decision. But I think an additional "will be executed" sub-node is a different story, the threshold shouldn't be done on a per-node basis. That partitioning of the plan tree is kind of what I was trying to get at... Greetings, Andres Freund