Re: Check lateral references within PHVs for memoize cache keys

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Check lateral references within PHVs for memoize cache keys
Date: 2024-06-18 01:47:27
Message-ID: CAMbWs4-n-bc=cxXwn7oY0E8YojSwiVLUpz6+OqPre3_YJs1_NQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 18, 2024 at 4:36 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Here is another rebase over master so it applies again. I also added a
> commit message to help review. Nothing else has changed.

AFAIU currently we do not add Memoize nodes on top of join relation
paths. This is because the ParamPathInfos for join relation paths do
not maintain ppi_clauses, as the set of relevant clauses varies
depending on how the join is formed. In addition, joinrels do not
maintain lateral_vars. So we do not have a way to extract cache keys
from joinrels.

(Besides, there are places where the code doesn't cope with Memoize path
on top of a joinrel path, such as in get_param_path_clause_serials.)

Therefore, when extracting lateral references within PlaceHolderVars,
there is no need to consider those that are due to be evaluated at
joinrels.

Hence, here is v7 patch for that. In passing, this patch also includes
a comment explaining that Memoize nodes are currently not added on top
of join relation paths (maybe we should have a separate patch for this?).

Thanks
Richard

Attachment Content-Type Size
v7-0001-Check-lateral-refs-within-PHVs-for-memoize-cache-keys.patch application/octet-stream 12.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-06-18 01:57:30 Re: Inval reliability, especially for inplace updates
Previous Message Li, Yong 2024-06-18 01:12:42 Re: Separate HEAP WAL replay logic into its own file