This feature enables Druid to greatly improve the query performance, especially when the query dataSource has a very large number of dimensions but the query only required several dimensions. This feature includes two parts. One is materialized-view-maintenance, and the other is materialized-view-selection.

    In materialized-view-maintenance, dataSources user ingested are called “base-dataSource”. For each base-dataSource, we can submit derivativeDataSource supervisors to create and maintain other dataSources which we called “derived-dataSource”. The dimensions and metrics of derived-dataSources are the subset of base-dataSource’s. The derivativeDataSource supervisor is used to keep the timeline of derived-dataSource consistent with base-dataSource. Each derivativeDataSource supervisor is responsible for one derived-dataSource.

    Supervisor Configuration

    Context

    Materialized-view-selection

    A sample view query spec is shown below:

    1. {
    2. "queryType": "view",
    3. "query": {
    4. "queryType": "groupBy",
    5. "dataSource": "wikiticker",
    6. "dimensions": [
    7. "user"
    8. ],
    9. "type": "default",
    10. "limit": 1,
    11. "columns": [
    12. {
    13. "dimension": "added",
    14. "direction": "descending",
    15. "dimensionOrder": "numeric"
    16. }
    17. ]
    18. {
    19. "type": "longSum",
    20. "name": "added",
    21. "fieldName": "added"
    22. }
    23. ],
    24. "intervals": [
    25. "2015-09-12/2015-09-13"
    26. ]
    27. }

    There are 2 parts in a view query: