AWS Certified Data Engineer Associate DEA-C01 Practice Question
An online retailer stores shopping-cart items in a single DynamoDB table. Each record has the attributes userId, productId, quantity, addedAt, and expiresAt (30-day TTL). The application must:
Retrieve and update an entire cart for a given user with one strongly consistent read.
Occasionally return all carts that contain a specific productId. Which table design satisfies these requirements at the lowest cost?
Partition key userId and sort key productId with no secondary indexes; the application scans the table to locate carts by productId.
Partition key userId and sort key addedAt; create a GSI with productId as the partition key and userId as the sort key; enable TTL on expiresAt.
Create a separate DynamoDB table for each user's cart and export data to S3 for cross-product queries.
Partition key productId and sort key userId; add an LSI on addedAt for cart lookups; enable TTL on expiresAt.
Storing all of a user's cart items under the same partition key lets the application fetch or update the complete cart with one strongly consistent Query operation. Making userId the partition key and an ever-increasing attribute such as addedAt the sort key groups those items together while preserving ordering. A global secondary index (GSI) whose partition key is productId provides an efficient access path for the much less frequent query that aggregates the same product across many users. TTL on expiresAt removes stale items automatically at no extra read/write cost and does not affect either access pattern. Scanning the base table, using productId as the primary key (which would require a scan for user carts), or relying on a local secondary index (which cannot use a different partition key) would all raise costs or fail to meet one of the query requirements.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is TTL in DynamoDB?
Open an interactive chat with Bash
What is the difference between a GSI and LSI in DynamoDB?
Open an interactive chat with Bash
What is a strongly consistent read in DynamoDB?
Open an interactive chat with Bash
What is a Partition Key and Sort Key in DynamoDB?
Open an interactive chat with Bash
What is a Global Secondary Index (GSI) in DynamoDB?
Open an interactive chat with Bash
How does TTL (Time-to-Live) work in DynamoDB?
Open an interactive chat with Bash
AWS Certified Data Engineer Associate DEA-C01
Data Store Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .