0
0
DynamoDBquery~20 mins

Index projection types (ALL, KEYS_ONLY, INCLUDE) in DynamoDB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DynamoDB Projection Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What does the KEYS_ONLY projection type include in a DynamoDB index?
In DynamoDB, when you create a secondary index with the KEYS_ONLY projection type, which attributes are included in the index?
AOnly the non-key attributes specified explicitly
BAll attributes from the base table
COnly the primary key attributes of the base table and the index key attributes
DAll attributes except the primary key attributes
Attempts:
2 left
💡 Hint
Think about what minimal data is needed to uniquely identify items in the index.
query_result
intermediate
1:30remaining
Which projection type returns all attributes in a DynamoDB index query?
You query a DynamoDB secondary index with the projection type set to ALL. What attributes will the query return?
AAll attributes from the base table item
BOnly the primary key attributes of the base table
COnly the index key attributes
DOnly the attributes explicitly included in the index
Attempts:
2 left
💡 Hint
ALL means everything is included.
📝 Syntax
advanced
2:00remaining
Identify the correct syntax to specify an INCLUDE projection with attributes in a DynamoDB index creation.
Which of the following JSON snippets correctly defines an INCLUDE projection with attributes 'Name' and 'Age' for a DynamoDB secondary index?
A{ "Projection": { "ProjectionType": "INCLUDE", "NonKeyAttributes": ["Name", "Age"] } }
B{ "Projection": { "ProjectionType": "INCLUDE", "Attributes": ["Name", "Age"] } }
C{ "ProjectionType": "INCLUDE", "NonKeyAttributes": ["Name", "Age"] }
D{ "Projection": { "Type": "INCLUDE", "NonKeyAttributes": ["Name", "Age"] } }
Attempts:
2 left
💡 Hint
Check the exact property names required by DynamoDB for projections.
optimization
advanced
2:00remaining
Choosing the best projection type for a read-heavy application with frequent queries on a few attributes
You have a DynamoDB table with many attributes, but your application mostly queries a few specific attributes along with the keys. Which projection type should you choose for the secondary index to optimize read performance and storage?
AALL, to have all attributes available for queries
BINCLUDE, specifying only the frequently queried non-key attributes
CNo projection, use the base table for all queries
DKEYS_ONLY, to minimize index size and speed up queries
Attempts:
2 left
💡 Hint
Think about balancing storage size and query efficiency for specific attributes.
🔧 Debug
expert
2:30remaining
Why does a query on a KEYS_ONLY projected index fail to return a non-key attribute?
You created a secondary index with KEYS_ONLY projection and query it expecting to get a non-key attribute 'Email'. The query returns no 'Email' attribute. Why?
ABecause the query syntax is incorrect and does not request 'Email'
BBecause the base table does not have the 'Email' attribute
CBecause 'Email' is not a valid attribute name in DynamoDB
DBecause KEYS_ONLY projection does not include non-key attributes like 'Email' in the index
Attempts:
2 left
💡 Hint
Recall what KEYS_ONLY projection includes in the index.