Re: Check lateral references within PHVs for memoize cache keys - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Check lateral references within PHVs for memoize cache keys
Date
Msg-id CAMbWs4-n-bc=cxXwn7oY0E8YojSwiVLUpz6+OqPre3_YJs1_NQ@mail.gmail.com
Whole thread Raw
In response to Re: Check lateral references within PHVs for memoize cache keys  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Check lateral references within PHVs for memoize cache keys
List pgsql-hackers
On Mon, Mar 18, 2024 at 4:36 PM Richard Guo <guofenglinux@gmail.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

pgsql-hackers by date:

Previous
From: "Li, Yong"
Date:
Subject: Re: Separate HEAP WAL replay logic into its own file
Next
From: Andres Freund
Date:
Subject: Re: Inval reliability, especially for inplace updates