You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Jesus Camacho Rodriguez (JIRA)" <ji...@apache.org> on 2019/03/21 22:21:00 UTC

[jira] [Created] (CALCITE-2943) Materialized view rewriting logic calls getApplicableMaterializations each time the rule is triggered

Jesus Camacho Rodriguez created CALCITE-2943:
------------------------------------------------

             Summary: 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
         Attachments: Screen Shot 2019-03-21 at 2.33.01 PM.png

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