Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2943

Materialized view rewriting logic calls getApplicableMaterializations each time the rule is triggered

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.20.0
    • core

    Description

      RelOptMaterializations.getApplicableMaterializations is called each time the rule is triggered.

      ...
            // 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);
      ...
      

      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.

      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.

      Attachments

        Issue Links

          Activity

            People

              jcamacho Jesús Camacho Rodríguez
              jcamacho Jesús Camacho Rodríguez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h