Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1twqqp-000acv-TD for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Mar 2025 23:04:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1twqYR-00BBq2-Vp for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Mar 2025 22:45:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1twqYR-00BBpt-ME for pgsql-hackers@lists.postgresql.org; Mon, 24 Mar 2025 22:45:59 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1twqYP-000xTW-1t for pgsql-hackers@lists.postgresql.org; Mon, 24 Mar 2025 22:45:59 +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 52OMjsTT1164846; Mon, 24 Mar 2025 18:45:54 -0400 From: Tom Lane To: Lukas Fittl cc: David Rowley , Andrei Lepikhov , Ilia Evdokimov , Daniel Gustafsson , PostgreSQL Hackers , Nikolay Samokhvalov Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment In-reply-to: References: <51A15CD7-E31B-483D-B911-D0EB9F5FF952@yesql.se> <44229379-3901-4cb0-8812-b354ef70d5e2@gmail.com> <8e12aa55-39eb-4e03-a8f7-077fe02309c3@gmail.com> <11c709e1-9b17-4c00-9ead-93609a09b9db@gmail.com> <1161645.1742854534@sss.pgh.pa.us> Comments: In-reply-to Lukas Fittl message dated "Mon, 24 Mar 2025 15:30:03 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1164844.1742856354.1@sss.pgh.pa.us> Date: Mon, 24 Mar 2025 18:45:54 -0400 Message-ID: <1164845.1742856354@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Lukas Fittl writes: > The main argument I had initially when proposing this, is that Memoize is > different from other plan nodes, in that it makes the child node costs > "cheaper". Clearly seeing the expected cache hit/ratio (that drives that > costing modification) helps interpret why the planner came up with a given > plan. Memoize is hardly unique in that respect. Merge Join sometimes expects that it won't have to read the inner input to completion, and reduces its cost estimate accordingly, and that confuses people. LIMIT also reduces the cost estimate of its input, though perhaps that doesn't surprise people. As I said, I'm not necessarily averse to showing these numbers somehow. But I don't think they belong in the default output, and I'm not even convinced that VERBOSE is the right place. pg_overexplain seems like it could be an ideal home for this sort of detail. regards, tom lane