public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ilia Evdokimov <[email protected]>
To: David Rowley <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Lukas Fittl <[email protected]>
Cc: Daniel Gustafsson <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Nikolay Samokhvalov <[email protected]>
Cc: Andrei Lepikhov <[email protected]>
Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment
Date: Sun, 27 Apr 2025 22:58:52 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAApHDvq0Zz3+nh9hPRBP-oAocFZETfhdE_jcN8aG+Thc24Zk5g@mail.gmail.com>
References: <CAP53Pky29GWAVVk3oBgKBDqhND0BRBN6yTPeguV_qSivFL5N_g@mail.gmail.com>
<[email protected]>
<CA+TgmoZ8qXiZmmn4P9Mk1cf2mjMMLFPOjSasCjuKSiHFcm-ncw@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<CAApHDvpT0Y1BfYgeWz+PkKaLBEff1izYOAjNSibhBTNFEdqLtg@mail.gmail.com>
<CA+TgmobDHmaNTqi5yLPJoW6fTCuiWOgF9CSCSHX_OTLmGxYRUQ@mail.gmail.com>
<CAApHDvqYL3OVvOsyvEPsDJ7h4zQh=LEygQgcQSN-TemRJLMb6Q@mail.gmail.com>
<[email protected]>
<CAApHDvpuM8jW-BGu7B=i6uv+jmndEo-2z_BYvj5JNmx=qV-uSQ@mail.gmail.com>
<[email protected]>
<CAApHDvqmyHuEt7rdFLJr4cZecbhno5OZ6iL5EQNNu9Oi1f93sQ@mail.gmail.com>
<[email protected]>
<CAApHDvq0Zz3+nh9hPRBP-oAocFZETfhdE_jcN8aG+Thc24Zk5g@mail.gmail.com>
Sorry for the delayed reply.
On 18.04.2025 00:29, David Rowley wrote:
> I know I did suggest that the hit_ratio should be a percent and it
> should be multiplied by 100.0. This seems fine for the text format as
> you can have the % unit there. However, looking at
> ExplainPropertyFloat(), we don't print the unit for non-text formats.
> I wonder if printing a number between 0 and 100 there will be
> confusing. I don't believe we have anything else in EXPLAIN that shows
> a percentage. I don't quite know what to do about this. One thought I
> had was to only * 100 for text format, but that might be more
> confusing.
I agree that displaying the percentage instead of the fraction is a
better choice, because it is much more convenient for analysis. If this
value were intended to be passed into some API for further computations,
it would make sense to keep it as a fraction to avoid unnecessary
multiplications and divisions by 100. However, such use cases seem
extremely unlikely.
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?
>
> Aside from that, I'd prefer the new fields in struct Memoize to be
> prefixed with "est_" the same as the existing "est_entries" field. I'm
> unsure why MemoizePath.calls becomes Memoize.lookups. Seems
> unnecessary and just means more brain space being used to maintain a
> mental model.
Agree.
--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.
view thread (30+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox