Hi luchen.xu

SubstitutionVisitor: based on pattern, and bottom-up visit.
MaterializedViewRule: analyze semantics with relnode, such as SPJA

I have focused on the way of SubstitutionVisitor, let me talk about the
advantages and disadvantages:

Advantages:
1. Expand easily: you can define a custom pattern to match and rewrite the
query's plan with mv.
2. Support out join: SubstitutionVisitor could pull-up condition under join.
3. Transcending the pattern of 'SPJA': SubstitutionVisitor support more
pattern, such as: Sort, Union

Disadvantages:
1. Not support compensate with union, which is implemented in
'MaterializedViewRule'
2. Affected by order of join, eg: query(a join b), mv(b join a)
3. Strong depending on normalization, such as project-pushdown,
filter-pushdown.

By the way, I have read the paper and code. MaterializedViewRule is limited
to the pattern of 'SPJA', and the type of join must be inner-join.
In my project, we have tried to expand it for the left-join case, and this
work is going on.
More relnode need be integrated into the MaterializedViewRule, such Sort.
MaterializedViewRule has too long a way to go, we could discuss it
continuously, and keep it better.


I hope it could help you.

Thanks
XuRenhe

徐保荣 <[email protected]> 于2022年1月21日周五 11:04写道:

> hello,
> This problems keeps making me puzzled.
>
>       question1: what is the differences between the two implemenrations
> of view-based query rewriting?Advantages and disadvantages
> based on view substitution( SubstitutionVisitor、rules:unifyrule)
> Rewriting using plan structural information(rules:MaterializedViewRule)
>
>    question2: Is there some materialized rewriting example where the first
> one not work but the second work? if can list , very thanks
>
> I look forward to hearing from you very much
> thanks
>
>
>
>
>
>  rules transformation
> Permalink
>
>
>

Reply via email to