Materialized View

    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. "limitSpec": {
    9. "type": "default",
    10. "limit": 1,
    11. "columns": [
    12. {
    13. "dimension": "added",
    14. "direction": "descending",
    15. "dimensionOrder": "numeric"
    16. }
    17. ]
    18. "aggregations": [
    19. {
    20. "type": "longSum",
    21. "name": "added",
    22. "fieldName": "added"
    23. }
    24. ],
    25. "intervals": [
    26. "2015-09-12/2015-09-13"
    27. ]
    28. }

    There are 2 parts in a view query: