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 1ueE5r-006d7R-3u for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Jul 2025 14:35:47 +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 1ueE5o-008lWE-Tm for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Jul 2025 14:35:45 +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 1ueE5o-008lW6-K5 for pgsql-hackers@lists.postgresql.org; Tue, 22 Jul 2025 14:35:44 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ueE5l-000F4v-1h for pgsql-hackers@lists.postgresql.org; Tue, 22 Jul 2025 14:35:44 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-455b002833bso22046035e9.0 for ; Tue, 22 Jul 2025 07:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753194940; x=1753799740; 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=dLgoBF6QmtpfvfTXc51ZvKgJ3Y4QL034VI4h3b+BWEc=; b=hYm/bEp6coaocTlvBXplozM2bSKUAXJhAFtdp46KQJDXXz/oHPASZUH5vBrJ/eSXVS wcDklaVVtlbExeqx6oMYUO2qhpbx0NVP8ZvOTTexU5KwxDjreFHPVkP+tuZNGGLfyuJf 6VFDVZ4YzdDA5NI7PSBRseCDoiXmCyqVt79UkyPcALtw0IOKPPduANg8U/aWsA/tdmT8 bkssBeXVk2AjRBn8sCfaSfgeB6+zvPYmMYEb4lFWwDMWHLfz4hVW9SU7q/9phCkidh/Q zAC8CsCdRnqITVYDZHcFq2vHCsSFXOA2ORwWmC+pSTaJWGkS5/LI7nB5LbnPt8QJ4XaN trPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753194940; x=1753799740; 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=dLgoBF6QmtpfvfTXc51ZvKgJ3Y4QL034VI4h3b+BWEc=; b=sUkYfFSK24sEzqJBqShm2ew6puwc2ORFyxzcUbvLYe8dyRevB0Cikrw6M31AdvzWvy PBgcyQCGHnAuGqN8wNZetNYNgdlwNn1rXN7FDtb59q16Y27SzPbq/Qp67Lc5Ns3160Je 27f5lG5wOG1Yi1rV65WZkHxwtahluNXI80MZhGN4JCZgK+n7cktWkcLOBk8j6TVAkBM7 zw+dmlR89iFudPybwytT7rqCLXs+lLcgpdwuNhDfl30Rfid9tL7B8O59CaJstC1jIwdP hpMGbRmJ2rWy6AycTaQulgtLjb+u3N/gdMByatjoDaidCblUL0jPJriFg2fqBDDw+NR9 Z51Q== X-Forwarded-Encrypted: i=1; AJvYcCU5e4L5nE8tTcDZOzCBYm0EuC7+NhWWDzuyGw237a5Kv6zwGud/Dy31n7uAw46yBul88vSm9I9rzW2C0BTV@lists.postgresql.org X-Gm-Message-State: AOJu0YwTL12j9gT9WtnTDC1s+JT+pqqTIARYTwH42BcqwN/GfgrdVWnj ZzocPg13CuWS5Hmo2yduAxU0GTB2xr4wFqaT6qJ+A2FwzsEOArA4UEKX X-Gm-Gg: ASbGncsU0Stuz47wvgMh/zaPe/eO5zvVU0kM3hxqqGGAJHOHv1eUnrTPbsswsVXm8T9 Y/e0mhHaZ36z84fdFjuJ/DkCxhABiFfDxze5TaPjT56KOdP7UzTieU7gyhM9AWKF+Mi8SwpoLLT Nyo4v8RLFtRRC7R3nV6uVE6JeoN0PBzcr7Ar7URMCZ3zNZib8Sh7BKg/XA7n5gRZ8+1mqPyVYgx fkSTucqJAJ6zh/W3uEfISjxqaVkos8QdfaCR2x8gJhg5WHh+PqR/DrK381mgbyUCj8QT5Kk4ldv ooT3ezWTPYQW1H8zyAyWBeaZBjHbi3PWif8SHvGxP0b4zkvxAr5bsFn1lC0N/7D0pGQnIJXKawK E7vEO/+HH12EJtleg9r/pG5L9LUem7Xd7rg== X-Google-Smtp-Source: AGHT+IG7H2gEGYYMfAv29I2gMrgCC4NGYXtte2oo8VbB7Jkm0rFkDY5WqdZIDASO4J4HkCd161FqgA== X-Received: by 2002:a05:600c:4746:b0:455:ed0f:e8d4 with SMTP id 5b1f17b1804b1-456346daa1amr243810295e9.10.1753194939894; Tue, 22 Jul 2025 07:35:39 -0700 (PDT) Received: from [192.168.15.242] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4563b75cb86sm133788705e9.32.2025.07.22.07.35.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Jul 2025 07:35:39 -0700 (PDT) Message-ID: <34407b2d-946b-40cd-a665-49ca6af62fb9@gmail.com> Date: Tue, 22 Jul 2025 16:35:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment To: David Rowley , Ilia Evdokimov Cc: Robert Haas , Tom Lane , Lukas Fittl , Daniel Gustafsson , PostgreSQL Hackers , Nikolay Samokhvalov References: <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> <06840539-e321-4930-9f89-cfc783c5b80a@tantorlabs.com> <15e0422a-31ec-4e82-b0cf-0839f636b185@tantorlabs.com> <5c7034c4-c48b-428b-ab3f-67f14d9f542e@tantorlabs.com> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 22/7/2025 00:17, David Rowley wrote: > On Fri, 4 Jul 2025 at 20:30, Ilia Evdokimov > wrote: >> I attached rebased v10 patch on 5a6c39b. > > I've gone over this and made some cosmetic adjustments. A few > adjustments to the comments and used Cardinality rather than double > for some data types. I also moved the MemoizePath.calls field down > below est_entries so that est_entries would take up some padding > space. This saves 8 bytes of struct, and IMO, improves the logical > order of fields. I renamed "calls" to "est_calls" so it's more aligned > with the new fields being added by this patch. Looks good > > That removes the dilemma about which example to follow, but it's more verbose. The 'Buffers:' way looks more natural to me. I don't like duplicated text in the explain format - it is already cluttered by multiple unnecessary elements that distract attention from the problematic plan elements, such as unplaggable costs output if we only need row predictions, '.00' in estimations, etc. However, at first, I'd consider how it could be added to the IncrementalSort and HashJoin. The number of estimated groups/buckets may also provide some insights into the planner's decision. Will you add the ExplainOpenGroup call to the final version of the patch? -- regards, Andrei Lepikhov