Skip to content

Commit db6c7e2

Browse files
committed
GSI added, one limitation removed
1 parent 950cbfc commit db6c7e2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

articles/cosmos-db/nosql/materialized-views.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Materialized views (preview)
33
titleSuffix: Azure Cosmos DB for NoSQL
4-
description: Learn how to efficiently query a base container by using predefined filters in materialized views for Azure Cosmos DB for NoSQL. Use Materialized Views as Global Secondary Indexes.
4+
description: Learn how to efficiently query a base container by using predefined filters in materialized views for Azure Cosmos DB for NoSQL. Use materilaized views as global secondary indexes to avoid expensive cross-partition queries.
55
author: AbhinavTrips
66
ms.author: abtripathi
77
ms.reviewer: sidandrews
@@ -21,15 +21,18 @@ ms.date: 06/09/2023
2121
2222
Applications frequently are required to make queries that don't specify a partition key. In these cases, the queries might scan through all data for a small result set. The queries end up being expensive because they inadvertently run as a cross-partition query.
2323

24-
Materialized views, when defined, help provide a way to efficiently query a base container in Azure Cosmos DB by using filters that don't include the partition key. When users write to the base container, the materialized view is built automatically in the background. This view can have a different partition key for efficient lookups. The view also contains only fields that are explicitly projected from the base container. This view is a read-only table. The Azure Cosmos DB Materialized Views for NoSQL API, can be used as Global Secondary Indexes for your workloads.
24+
Materialized views, when defined, help provide a way to efficiently query a base container in Azure Cosmos DB by using filters that don't include the partition key. When users write to the base container, the materialized view is built automatically in the background. This view can have a different partition key for efficient lookups. The view also contains only fields that are explicitly projected from the base container. This view is a read-only table. The Azure Cosmos DB materialized views can be used as global secondary indexes to avoid expensive cross-partition queries.
2525

26-
With the Azure Cosmos DB Materialized Views (or the Global Secondary Index) for NoSQL API, you can:
26+
> [!IMPORTANT]
27+
> The materialized view feature of Azure Cosmos DB for NoSQL can be used as Global Secondary Indexes. Users can specify the fields that are projected from the base container to the materialized view and they can choose a different partition key for the materialized view. Choosing a different partition key based on the most common queries, helps in scoping the queries to a single logical partition and avoiding cross-partition queries..
28+
29+
With a materialized view, you can:
2730

28-
- Use the view as a lookup or mapping container to avoid cross-partition scans that would otherwise be expensive queries.
31+
- Use the view as a lookup or mapping container to persist cross-partition scans that would otherwise be expensive queries.
2932
- Provide a SQL-based predicate (without conditions) to populate only specific fields.
3033
- Use change feed triggers to create real-time views to simplify event-based scenarios that are commonly stored as separate containers.
3134

32-
The benefits of using materialized views include, but aren't limited to:
35+
The benefits of using Azure Cosmos DB Materiliazed Views include, but aren't limited to:
3336

3437
- You can implement server-side denormalization by using materialized views. With server-side denormalization, you can avoid multiple independent tables and computationally complex denormalization in client applications.
3538
- Materialized views automatically update views to keep views consistent with the base container. This automatic update abstracts the responsibilities of your client applications that would otherwise typically implement custom logic to perform dual writes to the base container and the view.
@@ -38,6 +41,7 @@ The benefits of using materialized views include, but aren't limited to:
3841
- You can configure a materialized view builder layer to map to your requirements to hydrate a view.
3942
- Materialized views improve write performance (compared to a multi-container-write strategy) because write operations need to be written only to the base container.
4043
- The Azure Cosmos DB implementation of materialized views is based on a pull model. This implementation doesn't affect write performance.
44+
- Azure Cosmos DB materialized views for NoSQL API caters to the Global Secondary Index use cases as well. Global Secondary Indexes are also used to maintain secondary data views and help in reducing cross-partition queries.
4145

4246
## Prerequisites
4347

0 commit comments

Comments
 (0)