Re: Trying to pull up EXPR SubLinks - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Trying to pull up EXPR SubLinks
Date
Msg-id CAKU4AWqN6gSGAj7mt+7KpC-OLvb9L7WLXc761bQw4Q9u0LBMow@mail.gmail.com
Whole thread Raw
In response to Re: Trying to pull up EXPR SubLinks  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: Trying to pull up EXPR SubLinks  (Dilip Kumar <dilipbalaut@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Juan José Santamaría Flecha
Date:
Subject: Re: PG compilation error with Visual Studio 2015/2017/2019
Next
From: Dilip Kumar
Date:
Subject: Re: Trying to pull up EXPR SubLinks