Re: A performance issue with Memoize

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A performance issue with Memoize
Date: 2024-01-26 07:54:45
Message-ID: CAApHDvpjnoUE=+MwUG7dBVrnpk0441n-O+-Oqe8R4bSi3r8qTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 26 Jan 2024 at 19:03, Richard Guo <guofenglinux(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-01-26 07:55:51 RE: speed up a logical replica setup
Previous Message Richard Guo 2024-01-26 07:42:33 Apply the "LIMIT 1" optimization to partial DISTINCT