Re: A performance issue with Memoize - Mailing list pgsql-hackers

From David Rowley
Subject Re: A performance issue with Memoize
Date
Msg-id CAApHDvpjnoUE=+MwUG7dBVrnpk0441n-O+-Oqe8R4bSi3r8qTA@mail.gmail.com
Whole thread Raw
In response to Re: A performance issue with Memoize  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-hackers
On Fri, 26 Jan 2024 at 19:03, Richard Guo <guofenglinux@gmail.com> wrote:
> At first I wondered if we should assume that the same param expr must
> have the same equality operator. If not, we should also check the
> operator to tell if the cache key is a duplicate, like
>
> -           if (!list_member(*param_exprs, expr))
> +           if (!list_member(*param_exprs, expr) ||
> +               !list_member_oid(*operators, hasheqoperator))

hmm, if that were the case you wouldn't do it that way. You'd need to
forboth() and look for an item in both lists matching the search.

> But after looking at how rinfo->left_hasheqoperator/right_hasheqoperator
> is set, it seems we can assume that: the operator is from the type cache
> entry which is fetched according to the expr datatype.

Yip.

> So I think the patch makes sense.  +1.

Thanks for reviewing. I've pushed the patch.

David



pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Apply the "LIMIT 1" optimization to partial DISTINCT
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: speed up a logical replica setup