The answer is that COUNT(DISTINCT) operations are expensive because they require data movement across distributions. In Azure Synapse Dedicated SQL Pool, when you run a COUNT(DISTINCT) on a column that is not the distribution key—such as visit_date in a table hash-distributed on user_id—the engine must shuffle all distinct values to a single distribution to eliminate duplicates before counting, a process known as data movement. This is a core performance concept tested on the Microsoft Azure Data Engineer Associate DP-203 exam, where you must recognize that hash distribution optimizes joins and aggregations on the distribution key but does not help with distinct counts on other columns. A common trap is assuming the hash distribution on user_id speeds up all aggregations, but COUNT(DISTINCT) on a different column forces a full data shuffle across all 60 distributions. Remember the mnemonic: "Distinct on a non-key? Data will flee."
DP-203 Design and implement data storage Practice Question
This DP-203 practice question tests your understanding of design and implement data storage. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
SELECT
COUNT(DISTINCT user_id) AS unique_users,
COUNT(DISTINCT session_id) AS unique_sessions
FROM visits
WHERE date BETWEEN '2024-01-01' AND '2024-01-31';
You run the above query on a table named 'visits' in a dedicated SQL pool. The table has 1 billion rows and is hash-distributed on user_id. The query takes a long time. What is the most likely reason?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue: "most likely"
Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
Refer to the exhibit.
SELECT
COUNT(DISTINCT user_id) AS unique_users,
COUNT(DISTINCT session_id) AS unique_sessions
FROM visits
WHERE date BETWEEN '2024-01-01' AND '2024-01-31';
A
The query uses a date filter which cannot be pushed down to the distribution.
Why wrong: Date filter can be pushed down, but the main bottleneck is the distinct count.
B
The table is hash-distributed on user_id, but the query uses a different column for aggregation.
Why wrong: user_id is the distribution key; this should help, but COUNT(DISTINCT) still requires shuffling.
C
The table should use a replicated distribution instead of hash distribution.
Why wrong: Replicated distribution is for small tables; this table is large.
D
COUNT(DISTINCT) operations are expensive because they require data movement across distributions.
COUNT(DISTINCT) needs to combine distinct values from all distributions.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
COUNT(DISTINCT) operations are expensive because they require data movement across distributions.
In a dedicated SQL pool, COUNT(DISTINCT) is inherently expensive because it requires all distinct values to be gathered across distributions before counting. Since the table is hash-distributed on user_id, the distinct count on a different column (likely visit_date or another attribute) forces data shuffling across all distributions to ensure uniqueness, causing significant performance degradation.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
The query uses a date filter which cannot be pushed down to the distribution.
Why it's wrong here
Date filter can be pushed down, but the main bottleneck is the distinct count.
✗
The table is hash-distributed on user_id, but the query uses a different column for aggregation.
Why it's wrong here
user_id is the distribution key; this should help, but COUNT(DISTINCT) still requires shuffling.
✗
The table should use a replicated distribution instead of hash distribution.
Why it's wrong here
Replicated distribution is for small tables; this table is large.
✓
COUNT(DISTINCT) operations are expensive because they require data movement across distributions.
Why this is correct
COUNT(DISTINCT) needs to combine distinct values from all distributions.
Clue confirmation
The clue word "most likely" in the question point toward this answer.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often blame the distribution key mismatch (Option B) or filter pushdown (Option A), overlooking the fact that COUNT(DISTINCT) forces a global data movement step regardless of distribution strategy.
Detailed technical explanation
How to think about this question
COUNT(DISTINCT) in a distributed MPP system like Azure Synapse Dedicated SQL Pool triggers a two-phase aggregation: first, each distribution computes local distinct counts, then a global shuffle moves all distinct values to a single distribution for final counting. This shuffle is a full data movement operation, often spilling to tempdb, and can be orders of magnitude slower than COUNT(*) or COUNT(column) without distinct. For large tables, alternatives like approximate_count_distinct or pre-aggregated summary tables are recommended.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.
Related glossary terms
Concepts from this question explained
These glossary pages explain the core terms tested in this DP-203 question in full detail.
Design and implement data storage — This question tests Design and implement data storage — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: COUNT(DISTINCT) operations are expensive because they require data movement across distributions. — In a dedicated SQL pool, COUNT(DISTINCT) is inherently expensive because it requires all distinct values to be gathered across distributions before counting. Since the table is hash-distributed on user_id, the distinct count on a different column (likely visit_date or another attribute) forces data shuffling across all distributions to ensure uniqueness, causing significant performance degradation.
What should I do if I get this DP-203 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Are there clue words in this question I should notice?
Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
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 →
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.
This DP-203 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-203 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.