0
0
DynamoDBquery~5 mins

Global Secondary Index (GSI) concept in DynamoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Global Secondary Index (GSI) in DynamoDB?
A Global Secondary Index (GSI) is an index with a partition key and an optional sort key that can be different from those on the base table. It allows you to query data efficiently using alternate keys.
Click to reveal answer
intermediate
How does a GSI differ from a Local Secondary Index (LSI)?
A GSI can have a different partition key and sort key from the base table and can be created at any time. An LSI shares the same partition key as the base table but has a different sort key and must be defined when the table is created.
Click to reveal answer
beginner
Can you write to a GSI directly in DynamoDB?
No, you cannot write directly to a GSI. Writes happen on the base table, and DynamoDB automatically updates the GSI asynchronously to reflect those changes.
Click to reveal answer
beginner
Why would you use a GSI in DynamoDB?
You use a GSI to query data using different keys than the base table keys, enabling flexible and efficient queries on attributes that are not part of the primary key.
Click to reveal answer
intermediate
What is the consistency model of queries on a GSI?
Queries on a GSI are eventually consistent by default, meaning the index might not reflect the most recent writes immediately.
Click to reveal answer
Which of the following is true about a Global Secondary Index (GSI)?
AIt can only be created when the table is created.
BIt must have the same partition key as the base table.
CIt allows direct writes to the index.
DIt can have a different partition key than the base table.
When are writes to a GSI updated after writing to the base table?
AImmediately and synchronously.
BNever, GSIs are read-only.
CAsynchronously after the base table write.
DOnly when manually refreshed.
What type of consistency do GSI queries provide by default?
AStrong consistency
BEventual consistency
CTransactional consistency
DNo consistency guarantees
Which key(s) can a GSI have compared to the base table?
ADifferent partition key and optional sort key
BOnly the same partition key
COnly the same sort key
DNo keys, it indexes all attributes
Why might you add a GSI to a DynamoDB table?
ATo enable queries on attributes not in the primary key
BTo store backup copies of data
CTo enforce data validation rules
DTo speed up writes to the base table
Explain what a Global Secondary Index (GSI) is and how it helps in querying DynamoDB tables.
Think about how you can search a phone book by last name or by phone number.
You got /3 concepts.
    Describe the consistency and update behavior of a GSI after data is written to the base table.
    Consider how a copy of a document might take time to update after the original changes.
    You got /3 concepts.