Re: Trying to pull up EXPR SubLinks

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Subject: Re: Trying to pull up EXPR SubLinks
Date: 2020-04-24 09:11:16
Message-ID: CAKU4AWqN6gSGAj7mt+7KpC-OLvb9L7WLXc761bQw4Q9u0LBMow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> > 3. I added the material path in a very hacked way, the if check just
> to make
> > sure it take effect on my test statement only. If you want to test this
> patch locally,
> > you need to change the oid for your case.
> >
> > + if (linitial_node(RangeTblEntry, root->parse->rtable)->relid ==
> 25634)
> > + best_path = (Path *) create_material_path(final_rel,
> best_path);
>
Can we just directly add the material path on top of the best path? I
> mean there are possibilities that we might not get any benefit of the
> material because there is no duplicate from the outer node but we are
> paying the cost of materialization right? The correct idea would be
> that we should select this based on the cost comparison. Basically,
> we can consider how many duplicates we have from the outer table
> variable no?
>

Thanks for interesting of it. Of course we can't add the material path on
best path,
that's why I say it is a very hacked way. and say "how to cost this
strategy is
challenge " (the part you striped when you reply the email). But we have
to
test a path first (it must be helpful on some case at least) and the
result is correct,
then we think about how to cost it. The purpose of my writing is about the
first step
and see what people think about it.

As for how to cost it, I'm agreed with your suggestion, but we may need
more
than that, like. (1, 2, 1) and (1, 1, 2) is same for your suggestion, but
they
are not different in this path. and we also may be think about if we can
get a lower cost if we add a new sort path.

Best Regards
Andy Fan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-04-24 09:15:46 Re: Trying to pull up EXPR SubLinks
Previous Message Juan José Santamaría Flecha 2020-04-24 08:54:31 Re: PG compilation error with Visual Studio 2015/2017/2019