Bird
0
0

You created a Local Secondary Index (LSI) on a DynamoDB table but your query on the LSI returns no results even though matching items exist. What is the most likely cause?

medium📝 Debug Q14 of 15
AWS - DynamoDB
You created a Local Secondary Index (LSI) on a DynamoDB table but your query on the LSI returns no results even though matching items exist. What is the most likely cause?
AThe LSI was created with a different partition key than the main table.
BThe query used a filter expression instead of a key condition.
CThe query did not specify the same partition key as the main table.
DLSIs do not support queries, only scans.
Step-by-Step Solution
Solution:
  1. Step 1: Recall LSI key requirements

    LSI shares the same partition key as the main table, so queries must specify that partition key.
  2. Step 2: Analyze query behavior

    If the query does not specify the partition key, no results will be returned because partition key is mandatory for queries on LSI.
  3. Final Answer:

    The query did not specify the same partition key as the main table. -> Option C
  4. Quick Check:

    LSI queries require main table partition key [OK]
Quick Trick: LSI queries must include main table partition key [OK]
Common Mistakes:
  • Assuming LSI can have different partition key
  • Using filter instead of key condition for partition key
  • Believing LSI does not support queries

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes