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 1jzLZH-0005lk-No for pgsql-general@arkaria.postgresql.org; Sat, 25 Jul 2020 14:54:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jzLZG-0005Fr-1i for pgsql-general@arkaria.postgresql.org; Sat, 25 Jul 2020 14:54:30 +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 1jzLZF-0005Fk-QI for pgsql-general@lists.postgresql.org; Sat, 25 Jul 2020 14:54:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jzLZ9-0004mX-Ph for pgsql-general@lists.postgresql.org; Sat, 25 Jul 2020 14:54:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 06PEsIYB673333; Sat, 25 Jul 2020 10:54:18 -0400 From: Tom Lane To: David Rowley cc: Andres Freund , Scott Ribe , PostgreSQL General Subject: Re: bad JIT decision In-reply-to: References: <7736C40E-6DB5-4E7A-8FE3-4B2AB8E22793@elevated-dev.com> <629715.1595630222@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Sat, 25 Jul 2020 18:58:39 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <673331.1595688858.1@sss.pgh.pa.us> Date: Sat, 25 Jul 2020 10:54:18 -0400 Message-ID: <673332.1595688858@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley writes: > ... nested at the bottom level join, about 6 joins deep. The lack of > any row being found results in upper level joins not having to do > anything, and the majority of the plan is (never executed). On re-reading this, that last point struck me forcibly. If most of the plan never gets executed, could we avoid compiling it? That is, maybe JIT isn't JIT enough, and we should make compilation happen at first use of an expression not during executor startup. regards, tom lane