Announcing Materialized Views for Azure Cosmos DB for NoSQL (Preview)

thumbnail

Azure Cosmos DB Materialized Views

Azure Cosmos DB Materialized Views is a new feature that allows creating Materialized View Containers and keeping them in sync with the source container by defining which properties to populate in the Materialized View Container along with the choice of the new Partition Key. This feature reduces cross partition queries, RU charges, and improves query execution time, with zero coding effort and easy fine-tuning and monitoring of Materialized View Containers.

Benefits of using Azure Cosmos DB for NoSQL Materialized Views

The Azure Cosmos DB Materialized Views feature offers the following benefits:

  • Reduction in cross partition queries
  • Reduction in RU charges for the existing queries
  • Improvement in query execution time
  • Zero coding effort
  • Easy fine-tuning and monitoring of Materialized View Containers

Example use case for Materialized Views

A practical scenario for Materialized Views is where a non-partition-key field is frequently used as a filter. In such a case, a subset of the data from the source container can be copied to a new container and specified this non-partition-key field as the partition key. For example, Contoso Telecom can define a Materialized View that has a subset of data containing the mobile number and the billing data fields where the mobile number becomes the partition key.

Getting Started with Azure Cosmos DB for NoSQL Materialized Views

To use this preview feature, the following steps are required:

  1. Enabling the Materialized Views feature at the Azure Cosmos DB Account level from the Features blade in Azure Portal.
  2. Provisioning one or more instances of the Materialized View Builder at the database account level to handle the compute requirements related to the Materialized Views.

As of now, a maximum of 5 Materialized Views can be defined on a source container, and a single Materialized View container cannot fetch data from multiple source containers. PITR, hierarchical partitioning, and end-to-end encryption features are not supported on source containers on which Materialized Views are created.