Bird
0
0

You run a DynamoDB query on a single-table design with KeyConditionExpression: PK = :pk AND SK = :sk but receive no results, even though you know the item exists. What is a common cause of this issue?

medium📝 Debug Q7 of 15
DynamoDB - Access Patterns and Query Optimization
You run a DynamoDB query on a single-table design with KeyConditionExpression: PK = :pk AND SK = :sk but receive no results, even though you know the item exists. What is a common cause of this issue?
AThe table does not support queries with both PK and SK conditions
BThe attribute values for :pk or :sk do not exactly match the stored keys
CThe query syntax does not allow equality on SK
DDynamoDB does not support querying on composite keys
Step-by-Step Solution
Solution:
  1. Step 1: Verify exact key values

    Queries with equality conditions require exact matches on PK and SK values.
  2. Step 2: Common mistake

    Using incorrect or partial values for :pk or :sk causes no results.
  3. Final Answer:

    The attribute values for :pk or :sk do not exactly match the stored keys -> Option B
  4. Quick Check:

    Confirm exact key values used in query [OK]
Quick Trick: Exact key values required for equality queries [OK]
Common Mistakes:
MISTAKES
  • Using partial or incorrect key values in query
  • Assuming SK can be queried with inequality without begins_with
  • Misunderstanding query syntax for composite keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes