On 02.04.2025 00:06, David Rowley 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.
David
[1] https://postgr.es/m/CAApHDvqPkWmz1Lq23c9CD+mAW=hgPrD289tC30f3H1f6Ng59+g@mail.gmail.com
Apologies for not addressing your earlier suggestion properly. After reconsidering, I agree that showing ndistinct and est_entries in EXPLAIN ANALYZE when there are actual cache misses is the best approach. This is typically when users notice performance regressions and start investigating the cause, so surfacing planner expectations at that point can be the most useful. I attached v6 patch with changes.
--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC.