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:
{
"queryType": "view",
"query": {
"queryType": "groupBy",
"dataSource": "wikiticker",
"dimensions": [
"user"
"limitSpec": {
"type": "default",
"limit": 1,
"columns": [
{
"dimension": "added",
"direction": "descending",
"dimensionOrder": "numeric"
}
]
"aggregations": [
{
"type": "longSum",
"name": "added",
"fieldName": "added"
}
],
"intervals": [
"2015-09-12/2015-09-13"
]
}
There are 2 parts in a view query: