Skip to main content

AWS DVA-C02 Drill: DynamoDB Query Performance - Global Secondary Index vs. Scan

Jeff Taakey
Author
Jeff Taakey
21+ Year Enterprise Architect | AWS SAA/SAP & Multi-Cloud Expert.

Jeff’s Note
#

Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.

For DVA-C02 candidates, the confusion often lies in how to optimize query performance efficiently without resorting to costly or inefficient table scans. In production, this is about knowing exactly when to use Global Secondary Indexes (GSIs) versus parallel scans or capacity scaling. Let’s drill down.

The Certification Drill (Simulated Question)
#

Scenario
#

TechNova Solutions operates a web service that stores user-generated metadata items in an Amazon DynamoDB table. The table uses a “UserID” attribute as the partition key and “Timestamp” as the sort key. Recently, some API requests querying data based on the “Category” attribute — which is neither a partition key nor sort key — have started experiencing long response times. TechNova anticipates a significant increase in stored records. A developer is tasked with improving the performance of these specific queries efficiently.

The Requirement:
#

Identify the optimal architectural change that enhances query speed for non-key attributes in a scalable manner.

The Options
#

  • A) Increase the pagination size by setting the Limit parameter higher than default. Implement retry logic for requests that exceed provisioned throughput.
  • B) Create a Global Secondary Index (GSI) with “Category” set as the partition key, and query this index directly.
  • C) Perform a parallel scan operation by dividing the table into segments and scanning concurrently.
  • D) Enable read capacity auto scaling on the table and raise the maximum read capacity units (RCUs).

Google adsense
#

leave a comment:

Correct Answer
#

B

Quick Insight: The Developer Imperative
#

Efficient data access in DynamoDB hinges on matching query keys with index keys.
Using a GSI tuned to the query attribute greatly improves read performance versus scans or throughput increases.
Scan-based approaches should be last resort due to latency and cost.

Content Locked: The Expert Analysis
#

You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?


The Expert’s Analysis
#

Correct Answer
#

Option B

The Winning Logic
#

The query performance problem arises because queries filter on a non-key attribute (“Category”) which is not part of the base table’s partition or sort keys.

  • Creating a Global Secondary Index (GSI) that designates “Category” as the partition key enables efficient query operations directly on the index.
  • This avoids full table scans, reduces latency, and scales well as data volume grows.
  • GSIs maintain eventual consistency and allow applications to access data by alternate key structures.

The Trap (Distractor Analysis):
#

  • Why not A? Increasing the Limit on queries only reduces round trips but does not address unindexed attribute lookups. This does not improve query efficiency on non-key attributes.
  • Why not C? Parallel scans still require reading the entire table, are costly, and offer higher latency; unsuitable for frequent queries.
  • Why not D? Auto scaling read capacity units helps throughput but does not address the underlying inefficient access pattern, so queries remain slow.

The Technical Blueprint
#

import boto3

dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('TechNovaMetadata')

# Example of querying a GSI with "Category" as partition key
response = table.query(
    IndexName='CategoryIndex',
    KeyConditionExpression=Key('Category').eq('News')
)

items = response['Items']
print(f'Items in category "News": {items}')

The Comparative Analysis
#

Option API Complexity Performance Use Case
A Low Low Slightly reduces requests but not query efficiency
B Moderate High Best for querying by non-key attributes efficiently
C High Moderate Expensive full read, useful in rare bulk operations
D Low Low Increases throughput but doesn’t optimize queries

Real-World Application (Practitioner Insight)
#

Exam Rule
#

“For the exam, always pick Global Secondary Index (GSI) when querying on attributes that are not keys.”

Real World
#

“In production, parallel scans are sometimes used for one-off analytics or bulk exports, but for API responsiveness and scalability, GSIs are the best practice.”


(CTA) Stop Guessing, Start Mastering
#


Disclaimer

This is a study note based on simulated scenarios for the AWS DVA-C02 exam.

The DevPro Network: Mission and Founder

A 21-Year Tech Leadership Journey

Jeff Taakey has driven complex systems for over two decades, serving in pivotal roles as an Architect, Technical Director, and startup Co-founder/CTO.

He holds both an MBA degree and a Computer Science Master's degree from an English-speaking university in Hong Kong. His expertise is further backed by multiple international certifications including TOGAF, PMP, ITIL, and AWS SAA.

His experience spans diverse sectors and includes leading large, multidisciplinary teams (up to 86 people). He has also served as a Development Team Lead while cooperating with global teams spanning North America, Europe, and Asia-Pacific. He has spearheaded the design of an industry cloud platform. This work was often conducted within global Fortune 500 environments like IBM, Citi and Panasonic.

Following a recent Master’s degree from an English-speaking university in Hong Kong, he launched this platform to share advanced, practical technical knowledge with the global developer community.


About This Site: AWS.CertDevPro.com


AWS.CertDevPro.com focuses exclusively on mastering the Amazon Web Services ecosystem. We transform raw practice questions into strategic Decision Matrices. Led by Jeff Taakey (MBA & 21-year veteran of IBM/Citi), we provide the exclusive SAA and SAP Master Packs designed to move your cloud expertise from certification-ready to project-ready.