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

Reply via email to