AWS Certified Data Engineer - Associate (DEA-C01) free question 5 / 10 · Domain 2: Data Store Management
An application queries a DynamoDB table with TTL enabled for active promotions. Promotions whose TTL timestamp has passed still show up in query results for hours, although the business wants them hidden right after expiration. Which change fixes the query results?
- Turn TTL off and on again so that the table starts a new pass that deletes the expired items without delay
- Switch the table to eventually consistent reads so that the expired promotions are dropped from the result sets
- Add a filter expression to the Query that excludes items whose TTL attribute is equal to or less than the current time
- Raise the provisioned write capacity of the table so that the background process removes expired promotions sooner
Show the answer and explanation
Answer: C
Why this is correct
TTL deletes expired items in the background, typically within a few days after the expiration time, and until the deletion happens the items are still returned by read operations. They also still count towards storage and read costs. The page says that for Scan and Query a filter expression can remove the pending-deletion items from the results, by comparing the TTL attribute with the current time.
Why the other options are wrong
"Raise the provisioned write capacity of the table so that the background process removes expired promotions sooner" … TTL deletions do not consume write throughput, so more write capacity does not speed them up. The deletion happens within a few days of the expiration time.
"Switch the table to eventually consistent reads so that the expired promotions are dropped from the result sets" … The consistency model of a read does not hide items. Until the background process deletes them, the expired items continue to show in read and write operations.
"Turn TTL off and on again so that the table starts a new pass that deletes the expired items without delay" … Nothing on the page describes a way to trigger an immediate deletion. The items remain until the TTL process deletes them, and filtering is the documented way to exclude them.
Key points
For writes, a condition expression can avoid updating an item that has already expired. The check compares the expiration time with the current time and lets the write continue only when the item is still valid.