Re: A performance issue with Memoize

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: A performance issue with Memoize
Date: 2023-10-31 06:19:31
Message-ID: CAMbWs4-OmOT0nnAKSQ8ydeu_ZvxYcjfzQS9GEuyOXpPaqqQwXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 31, 2023 at 1:36 PM Andrei Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
wrote:

> On 30/10/2023 14:55, Richard Guo wrote:
> >
> > On Thu, Oct 26, 2023 at 12:07 PM Andrei Lepikhov
> > <a(dot)lepikhov(at)postgrespro(dot)ru <mailto:a(dot)lepikhov(at)postgrespro(dot)ru>> wrote:
> >
> > Do you've thought about the case, fixed with the commit 1db5667? As I
> > see, that bugfix still isn't covered by regression tests. Could your
> > approach of a PARAM_EXEC slot reusing break that case?
> >
> >
> > Hm, I don't think so. The issue fixed by commit 1db5667 was caused by
> > sharing PARAM_EXEC slots between different levels of NestLoop. AFAICS
> > it's safe to share PARAM_EXEC slots within the same level of NestLoop.
> >
> > The change here is about sharing PARAM_EXEC slots between subquery's
> > subplan_params and outer-relation variables, which happens within the
> > same level of NestLoop.
> > ...
> > Did you notice a case that the change here breaks?
> >
> > Hi Tom, could you share your insights on this issue and the proposed
> > fix?
>
> I think your patch works correctly so far. I mentioned the commit
> 1db5667 because, as I see, the origin of the problem was parallel
> workers. I have thought about pushing Memoize down to a parallel worker
> and couldn't imagine whether such a solution would be correct.
> Sorry if I disturbed you in vain.

Thanks for mentioning commit 1db5667, which brings my attention to more
aspects about the PARAM_EXEC mechanism. I don't think the discussion is
in vain. It helps a lot.

Thanks for looking into this patch.

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2023-10-31 07:25:17 Re: Statistics Import and Export
Previous Message Ashutosh Bapat 2023-10-31 06:11:45 Relids instead of Bitmapset * in plannode.h