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 1ueN4z-008lPm-IB for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Jul 2025 00:11:30 +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 1ueN4y-00GDNi-CD for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Jul 2025 00:11:28 +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 1ueN4y-00GDNa-2Q for pgsql-hackers@lists.postgresql.org; Wed, 23 Jul 2025 00:11:28 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ueN4w-000I3r-2b for pgsql-hackers@lists.postgresql.org; Wed, 23 Jul 2025 00:11:27 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-55502821bd2so7359787e87.2 for ; Tue, 22 Jul 2025 17:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753229483; x=1753834283; 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=jEHx7roVP6ZNg2f92n+mbQd5Z2COrkz7BDr648fIPbA=; b=Mim+KNA+qJ+2XkXvL4obM1x9ZcGU1Yj2oshHPRWjQDuwFQwidJ6P9lSmePyk2LUutJ gxgTFwu1nHBxYWvArPiC368W6bPQtCbZdzaAamG2+AW5PAYC5tnqEbztz9YTaErPT6qV antoXWjQy8LAzC1lI/FzCu8DyKDlZWpUj4QwCavpRdeYb62EWV+p6xTTCKY72gdSUebB TIo2HSJL/qXhs3NOdqRveUKwEOeCFcC6vzkeBMHewrKHTax/TxVk4pIGoKquoPst0CF1 GZjH5wJgJ72xF8UjCYrTGlf7+tGebpKzqs9LHyqh7U8BRF/xEuvB2aGb3kPB7GiWmFyy trlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753229483; x=1753834283; 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=jEHx7roVP6ZNg2f92n+mbQd5Z2COrkz7BDr648fIPbA=; b=o2e5q8EJQDjUY6c7zp6lS+v9T2U+whLjXRG7RyEQT3Cl5cGUptYi3VM10F+EHhn3Wl BxeZ+hSqLznvayiHTb0uM52LeexgD+7GNV13o04pq96E9NDA7zcsZpeJmELvAvTCmQvt 6KtWn2UHKc97rSkPLl8u2y+QKQBfsjGRbN+GaHcvaACKuehsJcuVVISujl3XdM/q9An+ Ugb4pyBAg1yYn3BxZcrtTeA5N+a/qLS4beslDHzYGXH+g1XwI9JM7KhZvvkX6vAwwRja WArJMMQUaZwm8jlA2AZEbJ4g63ffDHvBz6OwFSSmm3CyuRbbxJ9czmwnY45t03fvfKPe 4R0Q== X-Forwarded-Encrypted: i=1; AJvYcCWAtkkehINS6Panj7n4c0DMtmgqNvPPelkhfJBCQNoIQBBcehKEeMmMySRnp43PQDzPEFkJuaXMtZDWvj36@lists.postgresql.org X-Gm-Message-State: AOJu0YxWs89h2QL4qEfmrP20LltiXiih4WIwS2hQ+lvSDZE8VkBua4pd H+6daYjp0RCj4d+cm4Q+euYkH+M8HlsIWqoXpkJstMbptuud6QInmiKt8gbqE/U/NnKibrBDxJh SKhv/ewMs8VGiHX0J/5nGNzE3tCB3R/w= X-Gm-Gg: ASbGncvalcPlFPYS6KPN8Muzwu03Ne39tY8kFG7v9jVRFSbX267bIzM+ZgeV7bwRoWx s9Q0gwzvpZbGm7dQOSX+Y3Nwm/98s5wQ/zvDgo2QYe1BipuuWrkAfIYZn8LHsDlFbaxfJ+iq+zs rdM5Q/Xe6dhaB+O4/+E7uqHzPW/NJWIkAceVfMMMN3hICPonmrqzJp4XPd2MLEJpyYn2oO11URo JrSMKVXa0z+LzBfpoe+QnpC0MZrb/A94KDh54D2QQ== X-Google-Smtp-Source: AGHT+IG8ET/GRV/7xtoDkGgprtOuvln4De9e7SVPVnSfizBAXcJNUZ2bFogLKPaRnuXHxO6aki9SJKrvfzUC/jkQEOM= X-Received: by 2002:a05:6512:2387:b0:553:d8ca:4fcb with SMTP id 2adb3069b0e04-55a513b208amr339995e87.21.1753229482695; Tue, 22 Jul 2025 17:11:22 -0700 (PDT) MIME-Version: 1.0 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> <34407b2d-946b-40cd-a665-49ca6af62fb9@gmail.com> In-Reply-To: <34407b2d-946b-40cd-a665-49ca6af62fb9@gmail.com> From: David Rowley Date: Wed, 23 Jul 2025 12:11:09 +1200 X-Gm-Features: Ac12FXymcZHP90X0VyG9lwmM1qUZN_HWcQc2AA55ySq6eSjdc5WRCC80GIPVBmg Message-ID: Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment To: Andrei Lepikhov Cc: Ilia Evdokimov , Robert Haas , Tom Lane , Lukas Fittl , Daniel Gustafsson , PostgreSQL Hackers , Nikolay Samokhvalov 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, 23 Jul 2025 at 02:35, Andrei Lepikhov wrote: > 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. Seems logical. > 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. Sounds like another patch for another thread. > Will you add the ExplainOpenGroup call to the final version of the patch? I'm leaning towards not doing that as a reader might expect all the "Estimates" to be within that group, but the estimated cost and row counts won't be in there. Maybe it's possible to circumvent that expectation by naming the group something like "MemoizeEstimates", but IMO, that seems excessive for 4 properties. Do you have an argument in mind to support adding the group? David