DP-420 · Question #138
The following is a sample of a document in orders. The orders container uses customerId as the partition key. You need to provide a report of the total items ordered per month by item type. The…
The correct answer is B. Configure the report to query a new materialized view. Populate the view by using the change. To quickly generate reports with minimal RU consumption on an analytical workload, a materialized view populated via the change feed is the most efficient solution.
Question
The following is a sample of a document in orders. The orders container uses customerId as the partition key. You need to provide a report of the total items ordered per month by item type. The solution must meet the following requirements:
- Ensure that the report can run as quickly as possible.
- Minimize the consumption of request units (RUs).
What should you do?
Options
- AConfigure the report to query orders by using a SQL query.
- BConfigure the report to query a new materialized view. Populate the view by using the change
- CConfigure the report to query orders by using a SQL query through a dedicated gateway.
- DConfigure the report to query a new materialized view. Populate the view by using SQL queries
How the community answered
(51 responses)- A6% (3)
- B82% (42)
- C10% (5)
- D2% (1)
Why each option
To quickly generate reports with minimal RU consumption on an analytical workload, a materialized view populated via the change feed is the most efficient solution.
Directly querying the orders container with a SQL query for aggregations, especially if it requires cross-partition queries, can be expensive in RUs and slower than querying a pre-aggregated view.
Creating a materialized view specifically for reporting aggregate data (total items ordered per month by item type) and populating it using the Azure Cosmos DB change feed is an efficient strategy. This approach pre-computes the aggregates, allowing the report to query the smaller, optimized view quickly and with minimal RUs, as it avoids complex, cross-partition queries on the main transaction store.
While a dedicated gateway can offer benefits for specific types of analytical queries or high-scale data ingestion, it does not fundamentally change the cost or performance of complex analytical queries on a transactional store compared to using a materialized view.
Populating a materialized view using periodic SQL queries would consume RUs repeatedly for the aggregation process and might not be as near real-time as using the change feed.
Concept tested: Cosmos DB analytical workloads materialized views
Source: https://learn.microsoft.com/azure/cosmos-db/change-feed-materialized-views
Topics
Community Discussion
No community discussion yet for this question.