An Amazon Redshift table named Employee uses a compound sort key composed of Region ID, Department ID, and Role ID. Which queries will gain the most performance improvement from this compound sort key? (Choose two.)
Choose an answer
Tap an option to check your answer.
Correct answer: Select * from Employee where Region ID='North America' and Department ID=20;, Select * from Employee where Region ID='North America' and Role ID=50;.
Why this is the answer
Redshift compound sort keys work by ordering data based on the specified columns in the exact order they are defined. Queries benefit most when they filter on the leading columns of the sort key. The compound sort key is (Region ID, Department ID, Role ID). Select from Employee where Region ID='North America' and Department ID=20; is highly efficient because it filters on the first two leading columns of the sort key. Select from Employee where Region ID='North America' and Role ID=50; is also efficient because it filters on the first leading column and then another column in the sort key, allowing Redshift to quickly narrow down the scan range. Select from Employee where Region ID='North America'; is efficient but less so than the two correct options, as it only uses the first sort key column. Select from Employee where Department ID=20 and Region ID='North America'; is functionally the same as the first correct option, but the order of conditions in the WHERE clause does not impact sort key utilization; Redshift optimizes this. Select from Employee where Role ID=50; is inefficient because it filters only on the third column of the sort key, without filtering on the preceding columns (Region ID, Department ID). This forces Redshift to scan a much larger portion of the table.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed