On Mon, Mar 18, 2024 at 4:36 PM Richard Guo <guofengli...@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
v7-0001-Check-lateral-refs-within-PHVs-for-memoize-cache-keys.patch
Description: Binary data