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 1u4Pp9-001mGN-KV for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Apr 2025 19:50:31 +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 1u4Po9-004OZy-Qd for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Apr 2025 19:49:30 +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 1u4Po9-004OZq-Gr for pgsql-hackers@lists.postgresql.org; Mon, 14 Apr 2025 19:49:30 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u4Po5-0005MA-34 for pgsql-hackers@lists.postgresql.org; Mon, 14 Apr 2025 19:49:29 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-391342fc1f6so4006487f8f.1 for ; Mon, 14 Apr 2025 12:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744660166; x=1745264966; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=elGobhZLSw2XYMvjmjVS6WysCDTcALHIMb7SzZvikag=; b=aBGOrPO4oL0DCPM4aYj0LbaawyUb2UGYicLedaYPaotBmdUXvR4U8Xt/Kurc8zsEdL LyuotOULnn/fZ2KA/LtyhpvJQWmrzBvVUl3fLMLoAitQzOjZ+RZKPR4zotkFaGsTcqCt 8wq3lU3CeMCK6kLRRStALlVedy6EFNpMyQdBFBzZ9GBzrkenJgtoLr+axivM1A3ZPNRM zhNzvbA77NSdGLSR3jNetPvzjaM4rw2T8Fg0kitRhQ6PM5M1T1iwomoqILWAjd8GhKaR LD6PCtkN3EgPeor/PwMLLvVHKENVI7uGA2wCjrZ43ct1hyoXB2HAVM0a5/ZhtzSSQ6fg zgVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744660166; x=1745264966; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=elGobhZLSw2XYMvjmjVS6WysCDTcALHIMb7SzZvikag=; b=nDFMQrCnlbMDaBC+/6NX0h6pxTxV8q92SpF3RZlKmTfEUCf2xIdvJClMu/9s0/t0cN U3gx8XRc6yGgsGi+tpp/4A++7wJN/4E3qXRA7o8ADvQP25m7jTt4vcBztYgpcu9BFQgw Xb8fwJrOm7rhnAgV9Nb7r4L/zCVWWkAA4S1//teijwqb6flCIpAujnowEyHdwsxErQ0/ 5cbchGb6shLKoMeFIPnFbs4/Xkzp5n5XD0EA1P1tvRFY0ey7oT73XaA2jHyWVotx3kKP /mhes5eyv+WNDNFvBn1plCPvPC2J2yVd9NO9OBPS9Hd1PlhlumP3g8lk7t96q9l0VNJF PP4g== X-Forwarded-Encrypted: i=1; AJvYcCXlE62cyAl+YoSlFtFcEx43XCC52WOlNeYUcN8baI021ub5jReckC0AS/sVy5r4O5brareSE1oJHwV8vbq9@lists.postgresql.org X-Gm-Message-State: AOJu0YyNcyJ/jtC0qdQTgdLJRJio12TjLDSn08/TDAUFLcNS91+WsMF4 iEYhEkM9vehKbef/VAUX7Oi+NEqxa4Vb9uxX9OWG2nAZlTJ6CSFv X-Gm-Gg: ASbGncukFMM7w3d3dlU3707q0LnCNh8ALxp/TZI+EUQSaLtm6ivzsnG4g4/Y/kFDog7 37nDmB4xTYoiTagO4iGx5LYq6spUEl2GfwR/AEq+jfV3K9mfuyACKmvJ+FvXtZsE6vHWsNNzjBQ 5jfYkmYw9I7t2nc2WijjpIg4hs6r5tS6gURjkVRHPWlAOrP+FpaJEgDpU5e4aIlxB1JLIBJvAQ8 URTI6PwngAZ7AJkx2/HppUH4py/MN/pPRgq2DGKQk2Xj2xfTiZExpqtdPqtxdB6bWPc7AxIz1I2 VBwoH9M9jzufMdCtM/nnF8rRQKJDIagkEK8Gctx/Xt58wIfGYeJwn/EYZRO6DfH1ocIllCh9KIk = X-Google-Smtp-Source: AGHT+IE6G7fhb8uafZ1Yg1lSiYUdhddpVDiMaGlZOOL9zHA9MsvkN8MwYjhghkzK2bVRDmvFlUzZDA== X-Received: by 2002:a5d:5982:0:b0:39a:c9ed:8657 with SMTP id ffacd0b85a97d-39ea5202284mr11009822f8f.17.1744660165484; Mon, 14 Apr 2025 12:49:25 -0700 (PDT) Received: from [192.168.0.89] (84.123.232.230.dyn.user.ono.com. [84.123.232.230]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39eaf43cccdsm11875877f8f.79.2025.04.14.12.49.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Apr 2025 12:49:24 -0700 (PDT) Message-ID: <779faa14-274a-4c29-a40b-72e92478586e@gmail.com> Date: Mon, 14 Apr 2025 21:49:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment To: Robert Haas , David Rowley Cc: Ilia Evdokimov , Tom Lane , Lukas Fittl , Daniel Gustafsson , PostgreSQL Hackers , Nikolay Samokhvalov References: <8e12aa55-39eb-4e03-a8f7-077fe02309c3@gmail.com> <11c709e1-9b17-4c00-9ead-93609a09b9db@gmail.com> <1161645.1742854534@sss.pgh.pa.us> <1164845.1742856354@sss.pgh.pa.us> <3ba16aa7-3cb2-4289-b773-522ae2f03a77@tantorlabs.com> <81ef0f5a-b6a1-4417-ae3a-2bae9b8d419e@gmail.com> <67b5c84a-dedd-4103-af7e-0117046102fe@tantorlabs.com> <580fe72c-85be-45a8-9e00-6b5417690557@tantorlabs.com> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/14/25 18:31, Robert Haas wrote: > On Tue, Apr 1, 2025 at 5:07 PM David Rowley wrote: >> I tried to move things along to address Tom's concern about not >> wanting to show this in EXPLAIN's standard output. I suggested in [1] >> that we could use EXPLAIN ANALYZE, but nobody commented on that. >> EXPLAIN ANALYZE is much more verbose than EXPLAIN already, and if we >> put these in EXPLAIN ANALYZE then the viewer can more easily compare >> planned vs actual. I had mentioned that Hash Join does something like >> this for buckets. > Having looked at v6, I think it would help, at least if the reader is > sufficiently knowledgeable. From the values displayed, it looks like > someone could reconstruct the evict_ratio value in > cost_memoize_rescan(), and if they know the loop count, also the > hit_ratio. But that seems hard: if you weren't reading the code, how > would you know how to do it? Even if you are reading the code, are you > sure you'd reconstruct it correctly? I wonder why we think it's better > to display this than a more "cooked" number like the estimated hit > ratio that was proposed in v1? +1. My reasons: a) it more "physical"; b) We don't need to look for the corresponding NestLoop JOIN node - my explans usually contain 150+ lines and it is hard to get into the analysis something out of current screen. -- regards, Andrei Lepikhov