Re: path->param_info only set for lateral?

From: James Coleman <jtc331(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: path->param_info only set for lateral?
Date: 2023-06-21 00:55:00
Message-ID: CAAaqYe8Lf5kF8ADPhkt3yY21nU6ATOrJbQBZpXCmoxNCSugpJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 18, 2023 at 10:57 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> James Coleman <jtc331(at)gmail(dot)com> writes:
> > Over in "Parallelize correlated subqueries that execute within each
> > worker" [1} Richard Guo found a bug in the current version of my patch
> > in that thread. While debugging that issue I've been wondering why
> > Path's param_info field seems to be NULL unless there is a LATERAL
> > reference even though there may be non-lateral outer params
> > referenced.
>
> Per pathnodes.h:
>
> * "param_info", if not NULL, links to a ParamPathInfo that identifies outer
> * relation(s) that provide parameter values to each scan of this path.
> * That means this path can only be joined to those rels by means of nestloop
> * joins with this path on the inside. ...
>
> We're only interested in this for params that are coming from other
> relations of the same query level, so that they affect join order and
> join algorithm choices. Params coming down from outer query levels
> are much like EXTERN params to the planner: they are pseudoconstants
> for any one execution of the current query level.
>
> This isn't just LATERAL stuff; it's also intentionally-generated
> nestloop-with-inner-indexscan-cases. But it's not outer-level Params.
> Even though those are also PARAM_EXEC Params, they are fundamentally
> different animals for the planner's purposes.

Thanks for the explanation.

I wonder if it'd be worth clarifying the comment slightly to hint in
that direction (like the attached)?

Thanks,
James Coleman

Attachment Content-Type Size
v1-0001-Clarify-param_info-query-level.patch application/octet-stream 1.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-06-21 01:21:04 Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX
Previous Message Peter Geoghegan 2023-06-21 00:12:10 Re: Optimizing "boundary cases" during backward scan B-Tree index descents