Re: An incorrect check in get_memoize_path

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: An incorrect check in get_memoize_path
Date: 2025-04-08 06:32:00
Message-ID: CAMbWs4-9SPmbmLUNvcwETptqtOW6Qb+AzPqu_FwBfteRxvRqyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 7, 2025 at 9:54 PM Andrei Lepikhov <lepihov(at)gmail(dot)com> wrote:
> On 4/7/25 09:50, Richard Guo wrote:
> > Consider the join to t3. It is a unique join, and not all of its
> > restriction clauses are parameterized. Despite this, the check still
> > passes.

> At the same time I think term 'Incorrect' is not good unless you show an
> example where data returned is not consistent to the expected.
> I think this inequality check has worked in couple with the
> get_equal_hashops.

Do you mean this check is designed to work in conjunction with the
clause_sides_match_join check in paraminfo_get_equal_hashops? I would
consider this a very poor design. The purpose of this check is simply
to verify whether all restriction clauses are parameterized. I don't
understand why it needs to depend on paraminfo_get_equal_hashops in
such an unexpected way to function correctly. I can't see any
advantage to this design, other than that it's prone to bugs.
Moreover, in the case where not all restriction clauses are
parameterized, why waste CPU cycles running all the code after the
check only for paraminfo_get_equal_hashops to catch it later?
Additionally, I couldn't find any comments explaining this unusual
behavior, either in the check itself or in paraminfo_get_equal_hashops.

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-04-08 06:40:52 Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions
Previous Message David Rowley 2025-04-08 06:31:16 Re: [PoC] Reducing planning time when tables have many partitions