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)?
✗ Incorrect
A GSI can have a different partition key than the base table, unlike an LSI which shares the partition key.
When are writes to a GSI updated after writing to the base table?
✗ Incorrect
DynamoDB updates GSIs asynchronously after writes to the base table.
What type of consistency do GSI queries provide by default?
✗ Incorrect
Queries on GSIs are eventually consistent by default.
Which key(s) can a GSI have compared to the base table?
✗ Incorrect
A GSI can have a different partition key and an optional sort key from the base table.
Why might you add a GSI to a DynamoDB table?
✗ Incorrect
GSIs allow querying data using alternate keys not in the base table's primary key.
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.