ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 125 - DEA-C01 discussion

Report
Export

A company stores employee data in Amazon Redshift A table named Employee uses columns named Region ID, Department ID, and Role ID as a compound sort key. Which queries will MOST increase the speed of a query by using a compound sort key of the table? (Select TWO.)

A.

Select * from Employee where Region ID='North America';

Answers
A.

Select * from Employee where Region ID='North America';

B.

Select * from Employee where Region ID='North America' and Department ID=20;

Answers
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';

Answers
C.

Select * from Employee where Department ID=20 and Region ID='North America';

D.

Select ' from Employee where Role ID=50;

Answers
D.

Select ' from Employee where Role ID=50;

E.

Select * from Employee where Region ID='North America' and Role ID=50;

Answers
E.

Select * from Employee where Region ID='North America' and Role ID=50;

Suggested answer: B, C

Explanation:

In Amazon Redshift, a compound sort key is designed to optimize the performance of queries that use filtering and join conditions on the columns in the sort key. A compound sort key orders the data based on the first column, followed by the second, and so on. In the scenario given, the compound sort key consists of Region ID, Department ID, and Role ID. Therefore, queries that filter on the leading columns of the sort key are more likely to benefit from this order.

Option B: 'Select * from Employee where Region ID='North America' and Department ID=20;' This query will perform well because it uses both the Region ID and Department ID, which are the first two columns of the compound sort key. The order of the columns in the WHERE clause matches the order in the sort key, thus allowing the query to scan fewer rows and improve performance.

Option C: 'Select * from Employee where Department ID=20 and Region ID='North America';' This query also benefits from the compound sort key because it includes both Region ID and Department ID, which are the first two columns in the sort key. Although the order in the WHERE clause does not match exactly, Amazon Redshift will still leverage the sort key to reduce the amount of data scanned, improving query speed.

Options A, D, and E are less optimal because they do not utilize the sort key as effectively:

Option A only filters by the Region ID, which may still use the sort key but does not take full advantage of the compound nature.

Option D uses only Role ID, the last column in the compound sort key, which will not benefit much from sorting since it is the third key in the sort order.

Option E filters on Region ID and Role ID but skips the Department ID column, making it less efficient for the compound sort key.

Amazon Redshift Documentation - Sorting Data

AWS Certified Data Analytics Study Guide

AWS Certification - Data Engineer Associate Exam Guide

asked 29/10/2024
M.G.Georgantzis QUALCO
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first