Question 257 of 820
DP-900 Practice Question: Identify considerations for relational data on Azure
A retail application uses Azure SQL Database. The Products table contains 200,000 rows with columns: ProductID (primary key, clustered), CategoryID, ProductName, Price, StockQuantity. Queries frequently filter on CategoryID and then sort results by Price in descending order. Which indexing strategy will most improve query performance for these operations?
⚠ Common exam trap
Microsoft often tests the misconception that including Price as an included column (Option B) is sufficient to optimize the sort, when in fact the index must be ordered by Price to avoid a separate sort operation.
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 (CategoryID, Price) with Price in descending order.
Creates a composite nonclustered index on (CategoryID, Price DESC) that directly supports both the filter (CategoryID equality) and the sort (Price descending) in a single index seek and ordered scan, eliminating the need for a separate sort operation. This is the most efficient strategy because the index is ordered exactly as the query requires, allowing SQL Server to retrieve matching rows in the correct order without additional processing.
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 CategoryID.
Why it's wrong here
A clustered index on CategoryID would physically reorder the entire table by Category, which could help group-related rows, but it would change the current clustered index from the primary key (ProductID), forcing primary key lookups to become key lookups into this new clustered index. More importantly, even with rows grouped by CategoryID, the query needs rows sorted by Price descending, and this index does not provide that ordering because within each CategoryID the Price values remain unsorted. The optimizer would still have to perform an explicit sort, so this does not satisfy the performance goal.
- ✗
Create a nonclustered index on CategoryID that includes Price as an included column.
Why it's wrong here
This nonclustered index would cover the WHERE clause because both CategoryID and Price are present in the index; however, the composite key structure only sorts by CategoryID first. Since Price is an included column, its values are stored at the leaf level but are not part of the index key, so they are not ordered within each CategoryID group. Consequently, after the index seek on a specific CategoryID, SQL Server must collect all matching rows and then run a separate SORT operation to deliver the requested descending Price order, which is exactly the work the query is trying to avoid.
- ✓
Create a nonclustered index on (CategoryID, Price) with Price in descending order.
Why this is correct
This index directly supports both the filter and the sort requirements because the index key columns are listed as (CategoryID, Price), and the Price column is explicitly designated as descending. For a given CategoryID, the index entries are stored in descending Price order, so the query optimizer can perform a seek to the first matching row and then scan forward to retrieve rows already sorted exactly as requested, eliminating the need for a sort operator. Additionally, if the query only references these two columns, the index is covering and avoids lookups, making it the optimal choice for this predicate and ordering.
- ✗
Create a clustered columnstore index on the table.
Why it's wrong here
A clustered columnstore index stores table data in a columnar format that is heavily compressed and optimized for analytical workloads that scan large numbers of rows, such as aggregation and reporting queries. It is not designed for the point lookups typical of an OLTP application, and because columnstore segments do not maintain a row-level sort order on a specific column like Price, the engine cannot use the index to satisfy the ORDER BY without performing a full sort. Moreover, retrieving individual rows or small subsets from a columnstore requires reading whole row groups, which would be slow for this retail application's interactive queries, so this option would likely worsen performance.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 30, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.