DP-900 Practice Question: Identify considerations for relational data on Azure
A company uses Azure SQL Database for its e-commerce platform. During a traffic spike, queries against the Orders table become slow. The table has 10 million rows and is clustered on OrderId. The most common query filters by CustomerId and OrderDate range. Which index change would most improve performance?
⚠ Common exam trap
A common mix-up: candidates choose the index with the most selective column first (OrderDate) without considering that the query uses an equality filter on CustomerId, which should be the leading key for optimal seek performance.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Create a nonclustered index on (CustomerId, OrderDate)
The most common query filters by CustomerId and OrderDate, so a nonclustered index on (CustomerId, OrderDate) provides a covering index that allows the database engine to quickly locate rows without scanning the entire clustered index. This index order supports equality on CustomerId and range scans on OrderDate, which is optimal for the query pattern. In Azure SQL Database, this reduces I/O and improves response time during traffic spikes.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Create a clustered index on CustomerId
Why it's wrong here
A clustered index determines the physical storage order of all rows in the table, so reassigning it to CustomerId would rewrite the entire table and potentially disrupt performance for queries that rely on the existing clustered key (typically the primary key). For the slow query filtering on CustomerId and OrderDate, this change does not help because the clustered index alone does not include OrderDate as a key column; matching orders for a customer would still require scanning all their rows and filtering on OrderDate. Moreover, the current clustered key may already serve other lookups, and altering it would incur significant overhead and lock time.
- ✗
Partition the table by OrderId
Why it's wrong here
Table partitioning physically splits data into separate storage segments based on the partition key, and it improves performance mainly when queries and maintenance operations align with that key. Partitioning by OrderId would not help a query that filters on CustomerId and OrderDate, because the query's predicates do not include OrderId, so it cannot use partition elimination and must still scan all partitions. In fact, partitioning by an irrelevant key can add overhead, as each partition may require separate index maintenance and B-tree traversals, making the query slower rather than faster.
- ✓
Create a nonclustered index on (CustomerId, OrderDate)
Why this is correct
A nonclustered index on (CustomerId, OrderDate) is the optimal choice because it lets the query optimizer seek directly to the index entry for a specific CustomerId and then perform a range scan on OrderDate within that customer's contiguous block of index rows. Since both columns are key columns, the index can also act as a covering index for the query if only these columns are needed, avoiding costly lookups to the clustered index. This arrangement is ideal for equality on the leading column and inequality/range on the second, which is exactly the pattern of the slow query.
- ✗
Create a nonclustered index on (OrderDate, CustomerId)
Why it's wrong here
When OrderDate leads the composite nonclustered index, the rows are sorted first by date and then by CustomerId, so the index is not aligned with the query's primary filtering column. To find a specific customer's orders, the optimizer must scan a range of dates and then test each row's CustomerId, instead of using a direct seek; this is especially inefficient if the query also filters by OrderDate with a range, because the second column cannot be used for seeking once a range predicate is applied to the first. A query with a constant CustomerId and a date range would require a full or partial scan of the index, making it slower than the correctly ordered index.
Visual reference
Go deeper
Related to this question
Learn chapter
Azure SQL Services
Key term
Table
A table is a structured collection of data organized into rows and columns, used in databases and spreadsheets to store and manage information efficiently.
Key term
Azure SQL Database
Azure SQL Database is a fully managed relational database-as-a-service (DBaaS) in Microsoft Azure, based on the SQL Server engine, that handles scaling, backups, patching, and high availability automatically.
About these practice questions
This DP-900 question is part of Courseiva's 820-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DP-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DP-900 exam.