Which design of the DynamoDB table primary key will have the MINIMUM performance impact?
Partition key on the office identifier and sort key on the employee name
Partition key on the employee name and sort key on the office identifier
Partition key on the employee name
Partition key on the office identifier
Explanations:
Using a partition key on the office identifier and a sort key on the employee name allows efficient querying by office. This design supports retrieving employees in alphabetical order for a specific office, resulting in minimal performance impact as all employees from a particular office are stored together, and the sorting is handled by the sort key.
This design uses the employee name as the partition key, which would distribute employees across multiple partitions. This results in inefficient queries for a specific office since it would require scanning multiple partitions to gather employees from one office, leading to higher read costs and longer response times.
A partition key on the employee name means that each employee’s information would be in separate partitions. This structure does not support efficient queries by office, requiring a full table scan to gather payroll information for a specific office, which is not optimal and impacts performance negatively.
While using the office identifier as a partition key allows for efficient retrieval of employees by office, it lacks the ability to sort employees alphabetically within each office. As a result, while it minimizes the number of partitions accessed, it does not provide the necessary ordering for the most frequent query, which is to retrieve employees in alphabetical order.