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

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(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>
Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment
Date: 2025-04-14 19:49:23
Message-ID: 779faa14-274a-4c29-a40b-72e92478586e@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/14/25 18:31, Robert Haas wrote:
> On Tue, Apr 1, 2025 at 5:07 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>> I tried to move things along to address Tom's concern about not
>> wanting to show this in EXPLAIN's standard output. I suggested in [1]
>> that we could use EXPLAIN ANALYZE, but nobody commented on that.
>> EXPLAIN ANALYZE is much more verbose than EXPLAIN already, and if we
>> put these in EXPLAIN ANALYZE then the viewer can more easily compare
>> planned vs actual. I had mentioned that Hash Join does something like
>> this for buckets.
> Having looked at v6, I think it would help, at least if the reader is
> sufficiently knowledgeable. From the values displayed, it looks like
> someone could reconstruct the evict_ratio value in
> cost_memoize_rescan(), and if they know the loop count, also the
> hit_ratio. But that seems hard: if you weren't reading the code, how
> would you know how to do it? Even if you are reading the code, are you
> sure you'd reconstruct it correctly? I wonder why we think it's better
> to display this than a more "cooked" number like the estimated hit
> ratio that was proposed in v1?
+1.
My reasons: a) it more "physical"; b) We don't need to look for the
corresponding NestLoop JOIN node - my explans usually contain 150+ lines
and it is hard to get into the analysis something out of current screen.

--
regards, Andrei Lepikhov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-04-14 19:59:03 Re: Fix a resource leak (src/backend/utils/adt/rowtypes.c)
Previous Message Wolfgang Walther 2025-04-14 19:46:29 Re: [PoC] Federated Authn/z with OAUTHBEARER