You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/nosql/index-metrics.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,13 @@ ms.reviewer: jucocchi
14
14
15
15
Azure Cosmos DB provides indexing metrics to show both utilized indexed paths and recommended indexed paths. You can use the indexing metrics to optimize query performance, especially in cases where you aren't sure how to modify the [indexing policy](../index-policy.md)).
16
16
17
-
> [!NOTE]
18
-
> The indexing metrics are only supported in the .NET SDK (version 3.21.0 or later) and Java SDK (version 4.19.0 or later)
17
+
## Supported SDK versions
18
+
Indexing metrics are supported in the following SDK versions:
You can capture index metrics by passing in the populate_index_metrics keyword in query items and then reading the value for "x-ms-cosmos-index-utilization" header from the response. This header is returned only if the query returns some items.
102
+
103
+
```python
104
+
query_items = container.query_items(query="Select * from c",
Copy file name to clipboardExpand all lines: articles/cosmos-db/nosql/materialized-views.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Materialized views (preview)
3
3
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.
5
5
author: AbhinavTrips
6
6
ms.author: abtripathi
7
7
ms.reviewer: sidandrews
@@ -21,15 +21,18 @@ ms.date: 06/09/2023
21
21
22
22
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.
23
23
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.
25
25
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:
27
30
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.
29
32
- Provide a SQL-based predicate (without conditions) to populate only specific fields.
30
33
- Use change feed triggers to create real-time views to simplify event-based scenarios that are commonly stored as separate containers.
31
34
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:
33
36
34
37
- 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.
35
38
- 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:
38
41
- You can configure a materialized view builder layer to map to your requirements to hydrate a view.
39
42
- Materialized views improve write performance (compared to a multi-container-write strategy) because write operations need to be written only to the base container.
40
43
- 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.
0 commit comments