Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

batchLoad on a Global Secondary Index in Dynamo

Is there a way to perform a batch Load from a table in DynamoDB using the Global Secondary index?

The batchLoad API accepts only HashKeys, and the queryPage API only lets you pass in a single key.

like image 593
vineet Avatar asked Jan 23 '17 23:01

vineet


People also ask

What is DynamoDB global secondary index?

DynamoDB supports two types of secondary indexes: Global secondary index — An index with a partition key and a sort key that can be different from those on the base table. A global secondary index is considered "global" because queries on the index can span all of the data in the base table, across all partitions.

How do I add a global secondary index in DynamoDB?

To add a global secondary index to an existing table, use the UpdateTable operation with the GlobalSecondaryIndexUpdates parameter. You must provide the following: An index name. The name must be unique among all the indexes on the table.

Can you update a global secondary index?

No, you cannot update items in a GSI. You make changes/updates to items in the table and those updates are propagated to the GSIs.


1 Answers

BatchLoad uses BatchGetItem behind the scenes. BatchGetItem can only read from the base table, and not from indexes (LSI, GSI). Therefore, you will need to run multiple Query operations in parallel on your GSI to achieve a similar effect.

like image 127
Alexander Patrikalakis Avatar answered Oct 11 '22 06:10

Alexander Patrikalakis