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 1ugaye-005BHm-NC for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jul 2025 03:26:09 +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 1ugayd-00Dl1w-LL for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jul 2025 03:26:07 +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 1ugayd-00Dl1n-Ba for pgsql-hackers@lists.postgresql.org; Tue, 29 Jul 2025 03:26:07 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ugaya-001PWc-1c for pgsql-hackers@lists.postgresql.org; Tue, 29 Jul 2025 03:26:07 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5551a770828so5230550e87.1 for ; Mon, 28 Jul 2025 20:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753759563; x=1754364363; 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=ssGGhgtzsbxRj/jJnjyXLZY2GYdPTY3o65BiJ0edjME=; b=R+YZhrY/sjM8pOK2Fg7mbmD5xlAJnETcBuPTllq9z5n/eXcURV/QR9P5XqudmDIdrj V7nnZME0OIeMdQbhJjTMpLOOumoyY+X5Z9jGtis0sPFVvE872CvRPJPoxsIwL4wCYgw5 2tLfy8M2KhyCAZb2gu0Ijk8Vkau7QSpytuBU/WbN52wgxQdsC0nShWYEPm8+g0lsXjI5 mRRAKkB1ydcKJad7Y020ESyQpje1c1FV5lm1ypR1PKdiJ/DEfHcTTL8rZSe5cyZSXiJP 6dLQvW3SGkWoiENSF1u/QExP52x0b4YpcrFgRC0oz9rvHSyZYGw0HTsrCo+7Twa8OYsk zsYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753759563; x=1754364363; 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=ssGGhgtzsbxRj/jJnjyXLZY2GYdPTY3o65BiJ0edjME=; b=C4qRF9cHik3MH/e7BlqjKnbtQbyHaRKGLlI5XNFA6YjBRDFD+KYoZ2NnVZ8vS/1i6A wtpYvjaLkuNecFNcvJiQRRTp+tC3xuQS++yc7GJc4WlYDMMshzA8hndimf2ct394ZTHw h7PnMVmAz1kqXjJuhsHRT0HMTbwu2mQv3kSinazSAr7bOs8NwcdBTRJZgJdbs52l5kRp 5oxc8pn+6y2nSytZ9eAsPMB3KqrE/rvOK+Cq6GNoKxWhQJ/E4eQCpBxnZ87x3/jG7Aeh QG/pCAKvpX0C4N2Q2Skx4rMi/HopyIWcG7pci82uR2Gh94Cn9qLNYJBlNa94ZPNc+HnJ 7oFQ== X-Forwarded-Encrypted: i=1; AJvYcCUE1AC32CDz7XwPQAjiH5s55kdiGgUsK4R5KFJR6lQ1VQtUM7XZ4DsWiviGGHcnWhqO9nUyEZifWf2PgyQ4@lists.postgresql.org X-Gm-Message-State: AOJu0YyHfkYdVDInTpbSqR+k76LtJavOx4werH4aMFRgA29uO6ywXm6X 81h4Tkc6l8jyty5vUQy4iqZzaKqmDCVej85ovOtisS3nG7zEhuMFuheHlViTqG5FREAfW72IjNK BVMioyg+RzQNw49e160B6iS/UqRu1XfA= X-Gm-Gg: ASbGncs5i+SxRsKkEzGAO9bdzRC5ep/k9TAzYJ4gzMSRPAoPS08wJYTwjt+N58DvtZr pFvINkowkAkS0zv8ouUhKylX14hyIs+Wf/Kvq4Ad2ly4x2sNBEHe0PPlk1uQ2bjjOZ2QwZ2EEj5 IwxUayJ3tISSwpVcDnTHnAJ1MIz4SFsu2bOtxYF5SJJ+PrSq72wbugUr1/iccKdjuPoUq/DZvfW nOKUK1HXezku9NXCAQfEF6mxwTXkvsJdZxUeRSu3A== X-Google-Smtp-Source: AGHT+IGz2BSpu9D6RN++SU14ZTLSeGUAy3AgBYkJYEnDNNhIcZrcSTjo87VBPd2i9LBIRkoPCQeZMUy4y+cuSMP0LtA= X-Received: by 2002:a05:6512:ac8:b0:553:cf7d:7283 with SMTP id 2adb3069b0e04-55b5f4808cfmr4055294e87.33.1753759562741; Mon, 28 Jul 2025 20:26:02 -0700 (PDT) MIME-Version: 1.0 References: <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> <3a4bff1b-f6d5-41d4-b956-2da25bed0aae@tantorlabs.com> In-Reply-To: <3a4bff1b-f6d5-41d4-b956-2da25bed0aae@tantorlabs.com> From: David Rowley Date: Tue, 29 Jul 2025 15:25:50 +1200 X-Gm-Features: Ac12FXzyu_kNe3Zpp3SbgP62DzgAHxXtxwRBShdtlAUEFfXeIh_W7muI2teJYOQ Message-ID: Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment To: Ilia Evdokimov Cc: Andrei Lepikhov , 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 23:08, Ilia Evdokimov wrote: > Given that, patch v11 still looks like the most appropriate version to me. I spent a bit more time cleaning a few things up in this. With all the complexity from the extra fields, I felt that a round of adjusting the "double" types so they use the "Cardinality" typedef where appropriate was in order. costsize.c isn't very good at doing that, but I didn't see that as a reason to make the problem worse. The only other change was in explain.c where I added a local "Memoize *" variable rather than casting the "plan" variable to the subclass type in each usage. I understand not everyone got what they wanted here, but I hope what's been added is ok for the majority of people. Thanks for working on this Ilia and Lukas. David