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 1uZ81X-00GSKW-El for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 13:06:16 +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 1uZ81V-008FKU-6F for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Jul 2025 13:06:13 +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 1uZ81U-008FKM-Sa for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 13:06:13 +0000 Received: from forward501a.mail.yandex.net ([178.154.239.81]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uZ81T-006SSC-0Z for pgsql-hackers@lists.postgresql.org; Tue, 08 Jul 2025 13:06:13 +0000 Received: from mail-nwsmtp-smtp-production-main-76.iva.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-76.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:bc97:0:640:ee90:0]) by forward501a.mail.yandex.net (Yandex) with ESMTPS id 634F062D19; Tue, 8 Jul 2025 16:06:09 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-76.iva.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 56hCNuTMKiE0-3AM5Nmew; Tue, 08 Jul 2025 16:06:08 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tantorlabs.com; s=mail; t=1751979968; bh=8zh8wXOgIFSND9SRhgAHPDU319iHnFaDhcgUKMI4Jxo=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=fP/mLD0/UHhsosR4hF21HKbc85NFk3h806W5aawhgwosawaRkckvs+qsWgl281NLb Z93M539NvfYui6KRwBJZ5hxg8MJPixGLVI88nn6QreW3BlG6/Ma4l6dvje1JCgeh5K /P3uLnjTEPpgivPx4AhsEYIaQVIfm2dQtRob2yRU= Authentication-Results: mail-nwsmtp-smtp-production-main-76.iva.yp-c.yandex.net; dkim=pass header.i=@tantorlabs.com Message-ID: Date: Tue, 8 Jul 2025 16:06:05 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment To: Andrei Lepikhov , David Rowley 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> <6642af90-561c-4f0c-9d5b-7e288e6e7f84@gmail.com> Content-Language: en-US From: Ilia Evdokimov In-Reply-To: <6642af90-561c-4f0c-9d5b-7e288e6e7f84@gmail.com> 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 07.07.2025 16:49, Andrei Lepikhov wrote: > Exposing internal information about the estimation of the number of > groups in the Memoise node, shouldn't we do the same in even more > vague cases, such as IncrementalSort? For example, in [1] (see its > attachment), I observe that IncrementalSort is considerably better > than Sort, but has a larger cost. It would be helpful to understand if > an incorrect ngroups estimation causes this. LGTM. If we still don't expose any information for nodes like IncrementalSort that would help explain why the planner chose them, then I fully agree - we definitely should add it. I suggest discussing that in a separate thread. -- Best regards, Ilia Evdokimov, Tantor Labs LLC.