Re: ERROR: corrupt MVNDistinct entry
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Andrei Lepikhov <lepihov@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-12-31T08:40:54Z
Lists: pgsql-hackers
Attachments
- v2-0001-Ignore-nullingrels-when-looking-up-statistics.patch (application/octet-stream) patch v2-0001
On Fri, Dec 27, 2024 at 1:16 PM Richard Guo <guofenglinux@gmail.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
Commits
-
Ignore nullingrels when looking up statistics
- e28033fe1af8 18.0 landed
- a1a9120c797d 16.7 landed
- 297b280abd7a 17.3 landed
-
Make Vars be outer-join-aware.
- 2489d76c4906 16.0 cited