Re: Trying to pull up EXPR SubLinks

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Andy Fan <zhihui(dot)fan1213(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:15:46
Message-ID: CAFiTN-sU1uzxMx0WXC4Ss6TcPeV3StK_31euX7fJVb9-wZuVLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 24, 2020 at 2:42 PM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:
>>
>>
>> > 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).

Right, I see that now. Thanks for pointing it out.

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.

Ok

>
> 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.

Valid point.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2020-04-24 09:24:03 Re: Trying to pull up EXPR SubLinks
Previous Message Andy Fan 2020-04-24 09:11:16 Re: Trying to pull up EXPR SubLinks