Question 1,436 of 1,730
Workload-Specific Database DesignhardMultiple ChoiceObjective-mapped

DynamoDB LSI to Reduce Query Latency for Recent Posts

This DBS-C01 practice question tests your understanding of workload-specific database design. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. A key principle to apply: scanIndexForward. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A social media application uses Amazon DynamoDB with a table that has a partition key of 'user_id' and a sort key of 'post_timestamp'. The application frequently queries for the 10 most recent posts by a specific user. The query pattern uses a 'begins_with' condition on the sort key with a timestamp prefix. Recently, the query latency has increased significantly for users with many posts. Which design change would improve query performance?

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 local secondary index (LSI) with 'user_id' as partition key and 'post_timestamp' as sort key, and query using reverse order with a limit of 10.

The optimal approach to retrieve the 10 most recent posts for a user is to query the table or an index with the partition key 'user_id' and use ScanIndexForward=false with a Limit of 10. Option A achieves this by creating a Local Secondary Index (LSI) with the same partition key and sort key as the base table. While the base table itself can be queried in reverse order, creating an LSI dedicated to this query pattern can improve performance by offloading reads from the base table index, reducing contention and ensuring fast consistent reads. The LSI can be provisioned with its own read capacity to handle the frequent queries for the most recent posts per user, thus improving overall query performance. Options B, C, and D do not effectively address the specific requirement of per-user recent posts. Option B (DAX) may reduce latency but does not fix the underlying inefficient query pattern (scanning many items per user). Option C (GSI with timestamp as partition key) would allow querying posts globally by time, not per user. Option D (changing partition key to post_id) would break the ability to query all posts by a user. Therefore, Option A is the correct design change.

Key principle: ScanIndexForward

Answer analysis

Option-by-option breakdown

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

  • Create a local secondary index (LSI) with 'user_id' as partition key and 'post_timestamp' as sort key, and query using reverse order with a limit of 10.

    Why this is correct

    Creating an LSI with 'user_id' as partition key and 'post_timestamp' as sort key allows querying in reverse order with a limit of 10, efficiently retrieving the most recent posts for a user.

    Related concept

    ScanIndexForward

  • Enable DynamoDB Accelerator (DAX) to cache the query results.

    Why it's wrong here

    DAX caches results but does not optimize the underlying query pattern; it may reduce latency for repeated queries but does not address the inefficient 'begins_with' condition.

  • Create a global secondary index (GSI) with 'post_timestamp' as partition key and 'user_id' as sort key.

    Why it's wrong here

    A GSI with 'post_timestamp' as partition key queries globally by timestamp, not per user, so it cannot efficiently retrieve the 10 most recent posts for a specific user.

  • Change the table's partition key to 'post_id' to distribute data more evenly.

    Why it's wrong here

    Changing the partition key to 'post_id' would break the existing query pattern and not improve performance for the common query of recent posts by user.

Common exam traps

Common exam trap: answer the scenario, not the keyword

A common trap is to think that a Local Secondary Index must have a different sort key than the base table. However, DynamoDB allows creating an LSI with the same sort key as the base table; this can be used to provision separate capacity for specific query patterns. Another trap is overlooking that the base table already supports reverse-order queries with ScanIndexForward=false, but creating an LSI can still be beneficial for workload isolation.

Detailed technical explanation

How to think about this question

An LSI allows you to query the same partition key with a different sort key order; in this case, using reverse order on post_timestamp with a limit of 10 ensures DynamoDB reads only the 10 most recent items from the index, avoiding the full scan of all items for that user. Under the hood, DynamoDB stores items in sorted order by sort key within each partition, so a reverse query on the LSI reads from the end of the sorted list, making it O(1) for a limited result set. In a real-world scenario, a user with millions of posts would cause the 'begins_with' filter on the base table to scan all items, while the LSI reverse query would return results in milliseconds.

KKey Concepts to Remember

  • ScanIndexForward
  • Local Secondary Index (LSI)
  • Workload Isolation

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

ScanIndexForward

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. ScanIndexForward Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Review scanIndexForward, then practise related DBS-C01 questions on the same topic to reinforce the concept.

Related practice questions

Related DBS-C01 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free DBS-C01 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this DBS-C01 question test?

Workload-Specific Database Design — This question tests Workload-Specific Database Design — ScanIndexForward.

What is the correct answer to this question?

The correct answer is: Create a local secondary index (LSI) with 'user_id' as partition key and 'post_timestamp' as sort key, and query using reverse order with a limit of 10. — The optimal approach to retrieve the 10 most recent posts for a user is to query the table or an index with the partition key 'user_id' and use ScanIndexForward=false with a Limit of 10. Option A achieves this by creating a Local Secondary Index (LSI) with the same partition key and sort key as the base table. While the base table itself can be queried in reverse order, creating an LSI dedicated to this query pattern can improve performance by offloading reads from the base table index, reducing contention and ensuring fast consistent reads. The LSI can be provisioned with its own read capacity to handle the frequent queries for the most recent posts per user, thus improving overall query performance. Options B, C, and D do not effectively address the specific requirement of per-user recent posts. Option B (DAX) may reduce latency but does not fix the underlying inefficient query pattern (scanning many items per user). Option C (GSI with timestamp as partition key) would allow querying posts globally by time, not per user. Option D (changing partition key to post_id) would break the ability to query all posts by a user. Therefore, Option A is the correct design change.

What should I do if I get this DBS-C01 question wrong?

Review scanIndexForward, then practise related DBS-C01 questions on the same topic to reinforce the concept.

What is the key concept behind this question?

ScanIndexForward

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Keep practising

More DBS-C01 practice questions

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This DBS-C01 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 DBS-C01 exam.