Amazon Redshift Compound Sort Key Query Optimization
A company stores employee data in Amazon Resdshift. A table names Employee uses columns named Region ID, Department ID, and Role ID as a compound sort key. Which queries will MOST increase the speed of query by using a compound sort key of the table? (Choose two.)
Community Votes
35% of anonymous learners picked answer BE. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
Compound sort keys are tested on leading column prefixes; the order of predicates in the WHERE clause does not impact the execution plan.
A compound sort key in Amazon Redshift improves query performance when filters are applied on the leading columns of the key. This page establishes that predicate order in the WHERE clause does not affect sort key utilization, making queries filtering on the first two sort key columns the most optimized.
Choosing A and B, assuming the predicate order must strictly match the sort key definition, or choosing B and E, incorrectly believing skipping the second column still fully utilizes the third.
Community Discussion (10 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Options B and C both filter on the first two columns of the compound sort key (Region ID and Department ID). Amazon Redshift compound sort keys are most effective when queries filter on leading columns, and the logical order of predicates in the WHERE clause does not affect the optimizer's ability to leverage the sort key. Therefore, both B and C equally and most significantly increase query speed by utilizing the longest possible sort key prefix available in the options.Why the Other Options Are Wrong
Option A only filters on the first column, providing less performance improvement than utilizing the first two columns. Option E filters on the first and third columns; because it skips the second column in the sort key, the third column cannot be used for zone map pruning, making it less effective than B or C. Option D filters only on the third column, completely skipping the leading columns, so it derives no benefit from the compound sort key.Community Comment Notes
Several users correctly pointed out that the predicate order in the SQL query is irrelevant to performance, noting that "the filter order in the query is irrelevant" because the sort key determines storage order. One user confirmed this with testing, stating "even inverting predicate order the explain plan was the same." Others mistakenly focused strictly on the written order of the sort key, leading them to incorrectly include Option A or E.Official Reference
Exam Strategy
When evaluating Redshift compound sort key effectiveness, identify queries that filter on the longest unbroken prefix of the sort key columns. Remember that the order of conditions in the WHERE clause does not matter; only the presence of the leading columns dictates sort key utilization.
Related Analysis
Practice All DEA-C01 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DEA-C01 Practice Test →