Re: ERROR: corrupt MVNDistinct entry

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ERROR: corrupt MVNDistinct entry
Date: 2024-12-31 08:40:54
Message-ID: CAMbWs48iYx=pxBP8O1NLz8wnbrQew3QJcMJOnmnNEFJzs+EAww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 27, 2024 at 1:16 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> I'm wondering if we also need to strip out the nullingrels from the
> expression in examine_variable(). I tried doing so and noticed a plan
> diff in regression test join.sql.

Here is an updated patch that implements this change, and also moves
the removal of the nullingrels within grouping expressions from
estimate_num_groups to add_unique_group_var.

I'm not quite sure how this change affects the exprs_known_equal call
in add_unique_group_var, possibly making it even less precise (it is
alreay somewhat fuzzy, as we do not provide a valid opfamily).
However, I think it should be fine for estimation purposes. Moreover,
in many cases, such as with groupClause, distinctClause, and
WindowClause's PARTITION BY clauses, we have already removed any items
that can be proven redundant.

Regarding the back-patch, this patch is a bug fix, which suggests it
should be back-patched. However, it also changes some plans by fixing
the cost estimation. Does anyone know what our usual approach is in
this situation?

Thanks
Richard

Attachment Content-Type Size
v2-0001-Ignore-nullingrels-when-looking-up-statistics.patch application/octet-stream 5.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Srirama Kucherlapati 2024-12-31 08:55:16 RE: AIX support
Previous Message Bertrand Drouvot 2024-12-31 07:53:18 Re: Autovacuum giving up on tables after crash because of lack of stats