Bird
0
0

How does the Query operation's performance compare to a Scan operation that filters for the same 100 items?

medium📝 service behavior Q4 of 15
AWS - DynamoDB
You have a DynamoDB table with 10,000 items. You run a Query operation specifying a partition key that matches 100 items. How does the Query operation's performance compare to a Scan operation that filters for the same 100 items?
AScan reads only the matching 100 items, Query reads all 10,000 items
BQuery reads all 10,000 items but returns only 100, Scan reads 100 items
CBoth Query and Scan read all 10,000 items internally
DQuery reads only the matching 100 items, while Scan reads all 10,000 items
Step-by-Step Solution
Solution:
  1. Step 1: Understand Query operation

    Query uses the partition key to directly access matching items, reading only those items.
  2. Step 2: Understand Scan operation

    Scan reads every item in the table and then applies filters, so it reads all 10,000 items.
  3. Final Answer:

    Query reads only the matching 100 items, while Scan reads all 10,000 items -> Option D
  4. Quick Check:

    Query is more efficient by reading fewer items [OK]
Quick Trick: Query reads only matching keys; Scan reads entire table [OK]
Common Mistakes:
MISTAKES
  • Assuming Scan reads fewer items due to filters
  • Believing Query reads entire table
  • Confusing filter application with read count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes