Introduction

In this lesson, we’ll quickly see some advanced topics that can help us improve security and cost when dealing with Cosmos DB in production scenarios.

Materialized views

Sometimes, we might need to query the same data differently, which usually means a different partition key. If we frequently query without a partition key, we have poor performance and high cost. The only solution might be duplicating the data in a different container with a new partition key and keeping the copy in sync.

Instead of doing this manually, we can now use the Materialized Views feature, currently in preview. We can specify the source container and query and the target container and partition key.

This way, we don’t need to think about the sync at all, and we can monitor the process from the portal!

Get hands-on with 1200+ tech skills courses.