0
0
DynamoDBquery~5 mins

Querying GSI 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 GSI is an index with a partition key and optional sort key that can be different from the base table's keys. It allows querying data efficiently using alternate keys.
Click to reveal answer
beginner
How do you specify which GSI to query in a DynamoDB Query operation?
You specify the GSI name using the 'IndexName' parameter in the Query request to tell DynamoDB which index to use.
Click to reveal answer
beginner
Can you use Query on a GSI without specifying the partition key?
No. You must specify the partition key value for the GSI to perform a Query operation. Without it, DynamoDB cannot efficiently find matching items.
Click to reveal answer
intermediate
What is the difference between querying a base table and querying a GSI in DynamoDB?
Querying a base table uses the table's primary key, while querying a GSI uses the GSI's partition and optional sort key. The GSI can have different keys and projections.
Click to reveal answer
beginner
Why might you use a GSI instead of scanning a table in DynamoDB?
A GSI lets you query efficiently using alternate keys without scanning the whole table, which saves time and reduces read capacity usage.
Click to reveal answer
What parameter do you use to query a GSI in DynamoDB?
AIndexName
BTableName
CKeyConditionExpression
DFilterExpression
Which key must you always provide when querying a GSI?
ASort key of the base table
BPartition key of the GSI
CPrimary key of the base table
DAny attribute
What happens if you query a GSI without specifying its partition key?
AQuery fails or returns no results
BReturns all items in the GSI
CReturns items from the base table
DAutomatically scans the table
Why use a GSI instead of scanning the whole table?
ATo delete items in bulk
BTo update items faster
CTo query efficiently using alternate keys
DTo increase table size
Can a GSI have a different partition key than the base table?
AOnly for local secondary indexes
BNo
COnly if the table is small
DYes
Explain how to perform a Query operation on a Global Secondary Index in DynamoDB.
Think about what parameters you need to tell DynamoDB which index and keys to use.
You got /4 concepts.
    Describe the benefits of using a Global Secondary Index instead of scanning a DynamoDB table.
    Consider how indexes help find data faster.
    You got /4 concepts.