nerdexam
Amazon

DVA-C02 · Question #372

A developer is working on an app for a company that uses an Amazon DynamoDB table named Orders to store customer orders. The table uses OrderID as the partition key and there is no sort key. The table

The correct answer is D. Create a global secondary index (GSI) with OrderSource as the partition key. Perform a Query. A Global Secondary Index (GSI) with OrderSource as the partition key enables efficient Query operations on an attribute that is not the table's partition key, avoiding costly full-table Scans.

Submitted by ashley.k· Mar 5, 2026Refactoring

Question

A developer is working on an app for a company that uses an Amazon DynamoDB table named Orders to store customer orders. The table uses OrderID as the partition key and there is no sort key. The table contains more than 100,000 records. The developer needs to add a functionality that will retrieve all Orders records that contain an OrderSource attribute with the MobileApp value. Which solution will improve the user experience in the MOST efficient way?

Options

  • APerform a Scan operation on the Orders table. Provide a QueryFilter condition to filter to only the
  • BCreate a local secondary index (LSI) with OrderSource as the partition key. Perform a Query
  • CCreate a global secondary index (GSI) with OrderSource as the sort key. Perform a Query
  • DCreate a global secondary index (GSI) with OrderSource as the partition key. Perform a Query

How the community answered

(27 responses)
  • A
    7% (2)
  • B
    4% (1)
  • C
    19% (5)
  • D
    70% (19)

Why each option

A Global Secondary Index (GSI) with OrderSource as the partition key enables efficient Query operations on an attribute that is not the table's partition key, avoiding costly full-table Scans.

APerform a Scan operation on the Orders table. Provide a QueryFilter condition to filter to only the

A Scan operation on a large table is highly inefficient because it reads every item before filtering; QueryFilter still processes all records first.

BCreate a local secondary index (LSI) with OrderSource as the partition key. Perform a Query

A Local Secondary Index (LSI) must share the same partition key as the base table (OrderID); it cannot be used to query by an entirely different attribute like OrderSource.

CCreate a global secondary index (GSI) with OrderSource as the sort key. Perform a Query

A GSI with OrderSource as the sort key still requires specifying a partition key for the GSI; you cannot query a GSI by sort key alone without also supplying the partition key value.

DCreate a global secondary index (GSI) with OrderSource as the partition key. Perform a QueryCorrect

A GSI with OrderSource as the partition key allows DynamoDB to index and retrieve all items sharing the same OrderSource value using a Query operation, which is significantly more efficient than a Scan on a 100,000+ record table. The Query reads only the relevant index partition rather than examining every item.

Concept tested: DynamoDB Global Secondary Index for alternate access patterns

Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice