[ 
https://issues.apache.org/jira/browse/CALCITE-2943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16798796#comment-16798796
 ] 

Stamatis Zampetakis commented on CALCITE-2943:
----------------------------------------------

Nice screenshot! Which program did you use to get it?

> Materialized view rewriting logic calls getApplicableMaterializations each 
> time the rule is triggered
> -----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2943
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2943
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: Screen Shot 2019-03-21 at 2.33.01 PM.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{RelOptMaterializations.getApplicableMaterializations}} is called each time 
> the rule is triggered.
> {code:java}
> ...
>       // Obtain applicable (filtered) materializations
>       // TODO: Filtering of relevant materializations needs to be
>       // improved so we gather only materializations that might
>       // actually generate a valid rewriting.
>       final List<RelOptMaterialization> applicableMaterializations =
>           RelOptMaterializations.getApplicableMaterializations(node, 
> materializations);
> ...
> {code}
> When I implemented the rule, I assumed (incorrectly) that 
> {{getApplicableMaterializations}} was a lightweight call and hence would help 
> discarding materialized views extracted from the planner quickly. It turns 
> out that the method can quickly become the most time consuming part of the 
> rule execution; I assume the method was just supposed to be used once per 
> query.
> !Screen Shot 2019-03-21 at 2.33.01 PM.png!
> Since the prefiltering that we do right now is rather simple and we already 
> extract the tables used by queries and materializations within the rule, we 
> can just skip the materialization over there.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to