Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment

From: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Lukas Fittl <lukas(at)fittl(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>
Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment
Date: 2025-05-01 12:22:34
Message-ID: 15e0422a-31ec-4e82-b0cf-0839f636b185@tantorlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 27.04.2025 22:58, Ilia Evdokimov wrote:
> Therefore, I think it is better to report percentages directly. Since
> non-text EXPLAIN formats do not display units, I propose to rename the
> field to "hit_percent" in all formats, including the text format. This
> way, the meaning of the value remains clear without needing additional
> context. What do you think about this approach?

I attached updated v9 patch with the suggested changes. The updated line
in the EXPLAIN looks like this:

Text format:
    Estimates: capacity=1 distinct keys=1 lookups=2 hit percent=50.00%

Non-text format:
    Estimated Capacity: 1
    Estimated Distinct Lookup Keys: 1
    Estimated Lookups: 2
    Estimated Hit Percent: 50.00

Any suggestions?

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.

Attachment Content-Type Size
v9-0001-Expose-cache-hit-statistics-in-Memoize-node-EXPLAIN.patch text/x-patch 7.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-05-01 12:40:21 Re: Prevent an error on attaching/creating a DSM/DSA from an interrupt handler.
Previous Message Alvaro Herrera 2025-05-01 12:14:50 Re: Issue attaching a table to a partitioned table with an auto-referenced foreign key