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 1u5gDt-004Onl-8B for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Apr 2025 07:33:17 +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 1u5gDr-008xdP-Gq for pgsql-hackers@arkaria.postgresql.org; Fri, 18 Apr 2025 07:33:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u5gDr-008xdF-6t for pgsql-hackers@lists.postgresql.org; Fri, 18 Apr 2025 07:33:16 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u5gDp-000fjQ-2u for pgsql-hackers@lists.postgresql.org; Fri, 18 Apr 2025 07:33:15 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5f5bef591d6so2287894a12.1 for ; Fri, 18 Apr 2025 00:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744961593; x=1745566393; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wrM4OHFHdPFqCHBAYf23tKIb68wCJhMw8UkzjFXdvBw=; b=DDXcUJyQxNKyYDzX1jWCEQd8Ct+eWpcQYHRRh4kgST36JtXLCNuVFCpx9g70wfGxBe l2LaJ1tmo5wHn1zHyWk9N9Uz9iwkSrfdd2iLzP5rcp2nXjkKEusDRu6nZPLLnFDN6/tH v/w2h1nubc4Uy2ZJGQUV3ciPwIU3VO4bgooAEZLmx0OPEinbnGOlmgIvDranXcNLEpSo yY5M0VfiBNKbllMDWksttj5HCFlJs1xczy46Mi0wYNWdxqHaLrvMzvwQSGBBrqBMzGRH ZXfOpWuTZrLITXQ2e9IHZbzMtTCSifN7qGjgp28d6ZQm84LtkJd7eNdfFkb420IO4uSF orLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744961593; x=1745566393; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wrM4OHFHdPFqCHBAYf23tKIb68wCJhMw8UkzjFXdvBw=; b=Di58sCdB2ujTInjaFmj8K8OaIS5KMK8KmsC7d0fCPv6iQ75O03vSxh1ziivV86PD9K VDdmaYsEjzUh+uL5rdOafJQkeFYo9wPpxGjvVIFkAEcQNc8epg0i0cXoootUTv9uRMDe cbdAG1rvfO/u0KMi6cwJhPnywB2vFmK1JfOmwy6EiKS/0VjTNTWoQF70IZejS6Lo++mi K1wWlM3W9WygyODUvhLXcT7bJ+UCzcYmTyLIj5hh8pRIgjgGEADzIcKChzEaeRhJsWYy TMJbjP8DFhv/vkUd8LqKzx2NO4x1kPZtPNzzMowmVU9FOV4W5lSj6utnt3QbkfEf16Jb Llxw== X-Forwarded-Encrypted: i=1; AJvYcCVijOyNKFLijSpwruL/HknIBgh0996H78L3uBxTE6aINYy/U+8cvM0t5ZqVo9w/YWlRzEJmRgAz2No8jwu2@lists.postgresql.org X-Gm-Message-State: AOJu0Yw+FiZqJBDCCLGAriKuebXWd0ZZjm8xRqsqO3F48Ou6xMDkCRRb 80GWmzghlndx2EhRvo/pEB9eI/9cLNndEPFBVjzrzPJFfXcpETLeMJ5u/RwT/UdBSohPB1G4Fmz hIF3GXeDhd9RuELTiSQBFem34njMXiMtL X-Gm-Gg: ASbGnctyxl62HERRwfPNt2sIS6WsnSuXbekxL/KwbnLE+wh0/3FRQyIVCCWDDbClsAw Zhl7B0huWm9dVx8qjZYKDCf6gHuwci/MaNHj7DK49nw9A1OXWuGVQx7iGUWtwuMl6/0X+wrAG8m MZCALpF+BIcK+U0TKgX9NPqNJyArAeOi2Bkx1F26VIrPBMw3jsizXNp7p3 X-Google-Smtp-Source: AGHT+IFPsBPNj8Dvv1qzRb9e4HgtpNUescyNAzFtwb7vGbh+kpgkE2BkwWegkhcRxmIxOucoQjvxVoCR/nRVB2bBulQ= X-Received: by 2002:a05:6512:1050:b0:545:2e5d:f3f3 with SMTP id 2adb3069b0e04-54d6e663016mr102549e87.46.1744925389687; Thu, 17 Apr 2025 14:29:49 -0700 (PDT) MIME-Version: 1.0 References: <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> <3ea66a50-e4b0-4f20-ae0c-4d9cbaf81cfb@tantorlabs.com> <0e8dc4fa-3655-4e9f-9424-9b32a15e6acd@tantorlabs.com> <7e995158-157e-4ec6-a7c8-266c1a6f7b43@tantorlabs.com> In-Reply-To: <7e995158-157e-4ec6-a7c8-266c1a6f7b43@tantorlabs.com> From: David Rowley Date: Fri, 18 Apr 2025 09:29:37 +1200 X-Gm-Features: ATxdqUGA381pSDgzsmA2p7PbcABgQgtxiljkYUGsoo7zju0ak56rRMB5fRoag3Q Message-ID: Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment To: Ilia Evdokimov Cc: Robert Haas , Tom Lane , Lukas Fittl , Daniel Gustafsson , PostgreSQL Hackers , Nikolay Samokhvalov , Andrei Lepikhov Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 16 Apr 2025 at 10:09, Ilia Evdokimov wrote: > I've prepared the updated patches as discussed, including the addition > of estimated lookups in the EXPLAIN output for Memoize. Please let me > know if you have any feedback or further suggestions. While this is fresh, as I might forget before the July CF... I know I did suggest that the hit_ratio should be a percent and it should be multiplied by 100.0. This seems fine for the text format as you can have the % unit there. However, looking at ExplainPropertyFloat(), we don't print the unit for non-text formats. I wonder if printing a number between 0 and 100 there will be confusing. I don't believe we have anything else in EXPLAIN that shows a percentage. I don't quite know what to do about this. One thought I had was to only * 100 for text format, but that might be more confusing. Aside from that, I'd prefer the new fields in struct Memoize to be prefixed with "est_" the same as the existing "est_entries" field. I'm unsure why MemoizePath.calls becomes Memoize.lookups. Seems unnecessary and just means more brain space being used to maintain a mental model. David