Q25 — AWS DVA-C02 Ch.3

Question 25 of 100 | ← Chapter 3

A company with multiple offices uses an Amazon DynamoDB table to store employee work order information. Each item contains attributes for employee name, office identifier, and cumulative daily work hours. The most frequent query retrieves a subset of employees per office, sorted alphabetically by employee name.

Correct Answer: A. Partition key on office identifier and sort key on employee name

Explanation

To optimize the most frequent query — retrieving employees per office sorted alphabetically — the primary key design must support efficient partitioning by office and sorting within partitions by employee name. Option A achieves this: the partition key (office identifier) groups all employees per office in the same partition, and the sort key (employee name) enables automatic lexicographic ordering within each partition, allowing efficient range queries (e.g., Query with KeyConditionExpression). Option B distributes employees across partitions by name, forcing cross-partition scans for office-based queries — inefficient. Option C lacks office context entirely, requiring full-table scans. Option D allows filtering by office but offers no sorting guarantee — requiring client-side sorting or additional indexes. Thus, option A delivers optimal performance and scalability.