Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Re: [POC] Allow flattening of subquery with a link to upper query

Lists: pgsql-hackers
From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: "Andrey V(dot) Lepikhov" <a(dot)lepikhov(at)postgrespro(dot)ru>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [POC] Allow flattening of subquery with a link to upper query
Date: 2022-10-04 21:45:11
Message-ID: CALNJ-vTa5VgvV1NPRHnypdnbx-fhDu7vWp73EkMUbZRpNHTYQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,
For contain_placeholders():

+ if (IsA(node, Query))
+ return query_tree_walker((Query *) node, contain_placeholders,
context, 0);
+ else if (IsA(node, PlaceHolderVar))

The `else` is not needed.

For correlated_t struct, it would be better if the fields have comments.

+ * (for grouping, as an example). So, revert its status
to
+ * a full valued entry.

full valued -> fully valued

Cheers


From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [POC] Allow flattening of subquery with a link to upper query
Date: 2022-10-05 11:38:10
Message-ID: 35c8a3e8-d080-dfa8-2be3-cf5fe702010a@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 5/10/2022 02:45, Zhihong Yu wrote:
> Hi,
> For contain_placeholders():
>
> +   if (IsA(node, Query))
> +       return query_tree_walker((Query *) node, contain_placeholders,
> context, 0);
> +   else if (IsA(node, PlaceHolderVar))
Fixed
>
> The `else` is not needed.
>
> For correlated_t struct, it would be better if the fields have comments.
Ok, I've added some comments.
>
> +                    * (for grouping, as an example). So, revert its
> status to
> +                    * a full valued entry.
>
> full valued -> fully valued
Fixed

--
regards,
Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
v3-0001-Transform-correlated-subquery-of-type-N-J-1-into-ord.patch text/plain 51.6 KB

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [POC] Allow flattening of subquery with a link to upper query
Date: 2022-10-05 14:11:54
Message-ID: CALNJ-vQ_1mB4BrObnP7V4VQxa48hPs9qw36A4bteve3VaH04Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Oct 5, 2022 at 4:38 AM Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
wrote:

> On 5/10/2022 02:45, Zhihong Yu wrote:
> > Hi,
> > For contain_placeholders():
> >
> > + if (IsA(node, Query))
> > + return query_tree_walker((Query *) node, contain_placeholders,
> > context, 0);
> > + else if (IsA(node, PlaceHolderVar))
> Fixed
> >
> > The `else` is not needed.
> >
> > For correlated_t struct, it would be better if the fields have comments.
> Ok, I've added some comments.
> >
> > + * (for grouping, as an example). So, revert its
> > status to
> > + * a full valued entry.
> >
> > full valued -> fully valued
> Fixed
>
> --
> regards,
> Andrey Lepikhov
> Postgres Professional
>
Hi,

+ List *pulling_quals; /* List of expressions contained pulled
expressions */

contained -> containing

+ /* Does the var already exists in the target list? */

exists -> exist

+ {"optimize_correlated_subqueries", PGC_USERSET, QUERY_TUNING_METHOD,

Is it possible that in the future there would be other optimization for
correlated subqueries ?
If so, either rename the guc or, make the guc a string which represents an
enum.

Cheers