Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A company has a DynamoDB table that stores order data. The table has a partition key of OrderID and a sort key of OrderDate. The company frequently queries orders by CustomerID, which is not a key attribute. The queries are slow and consume a lot of read capacity. Which design change would MOST improve query performance?

⚠ Common exam trap

Watch out — candidates often think increasing provisioned capacity (Option A) or using FilterExpression (Option D) will fix performance, but they fail to recognize that these do not change the underlying inefficient data access pattern of scanning all items.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Create a Global Secondary Index (GSI) with CustomerID as the partition key.

Creating a Global Secondary Index (GSI) with CustomerID as the partition key allows DynamoDB to efficiently query orders by CustomerID using the index's key structure, avoiding full table scans. This directly addresses the slow performance and high read capacity consumption by enabling targeted lookups instead of scanning all items and filtering.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Increase the provisioned read capacity for the table.

    Why it's wrong here

    Increasing provisioned read capacity units (RCUs) for the table primarily helps mitigate throttling issues for high-volume read operations. While it allows more concurrent reads, it does not fundamentally alter the inefficient nature of a `Scan` operation. A `Scan` still reads every item in the table, consuming RCUs proportional to the total data size, regardless of any filtering. Therefore, it will not make querying by `CustomerID` more efficient or faster than a full table scan.

  • Create a Global Secondary Index (GSI) with CustomerID as the partition key.

    Why this is correct

    Creating a Global Secondary Index (GSI) with `CustomerID` as its partition key is the most effective solution for efficiently querying items based on `CustomerID`. A GSI stores a copy of a subset of the base table's attributes, indexed by its own primary key (in this case, `CustomerID`). This allows `Query` operations to directly access items matching a specific `CustomerID` without scanning the entire base table, significantly improving performance and reducing cost for targeted lookups.

  • Change the table's primary key to use CustomerID as the partition key.

    Why it's wrong here

    Changing an existing DynamoDB table's primary key is not directly possible after creation. Implementing this would require creating an entirely new table with `CustomerID` as the partition key, migrating all existing data from the old table to the new one, and then updating all application code to reference the new table. This is an extremely disruptive, complex, and time-consuming operation, making it an impractical solution for simply adding efficient query capability on an existing attribute.

  • Use a FilterExpression on the CustomerID attribute in a Scan operation.

    Why it's wrong here

    Using a `FilterExpression` with a `Scan` operation on the `CustomerID` attribute is highly inefficient for retrieving specific items. A `Scan` operation always reads every single item in the entire table or index before applying the `FilterExpression`. Even if only a few items match the filter, the operation consumes read capacity units (RCUs) proportional to the total size of the data scanned, making it very costly and slow for large tables when only a small subset of data is needed.

About these practice questions

One of 724 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.