seniorCosmos DB

Design Patterns for Materialized Views over Cross-Partition Aggregate Change Feeds

Updated Apr 28, 2026

Short answer

Use the Change Feed Processor (CFP) to listen to a source container and project aggregated data into a separate, differently-partitioned 'View' container.

Deep explanation

In NoSQL, we often need to query the same data by different keys. Since cross-partition queries are expensive, we use the Change Feed to create Materialized Views. For aggregates (e.g., 'Total Sales per City'), the CFP reads the stream of changes and updates a summary document in a target container partitioned by 'City'. This ensures that the 'View' query is a single-partition point read or query, maximizing performance at the cost of slight data lag (eventual consistency).

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Cosmos DB interview questions

View all →