QuestionQ236

Data Store Management

A company stores employee data in Amazon Resdshift. A table named Employee uses columns named Region ID, Department ID, and Role ID as a compound sort key.

Which queries will benefit MOST in query speed from the table’s compound sort key?

Choose two
  • A Select *from Employee where Region ID=’North America’;
  • B Select *from Employee where Region ID=’North America’ and Department ID=20;
  • C Select *from Employee where Department ID=20 and Region ID=’North America’;
  • D Select *from Employee where Role ID=50;
  • E Select *from Employee where Region ID=’North America’ and Role ID=50;
Explanation

Amazon Redshift compound sort keys are most effective when query predicates constrain a leading prefix of the sort key. With the key ordered as Region ID, Department ID, and Role ID, filtering on both Region ID and Department ID uses the first two key columns. Predicate order in a SQL WHERE clause does not change the equivalent filtering conditions or their ability to use the sort key.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!