Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

more than 100 items through batchGetItem in dynamoDB

If you request more than 100 items, BatchGetItem returns a ValidationException with the message "Too many items requested for the BatchGetItem call." Is there any way to process more than 100 items in dynamoDB through batchGetItems.

like image 278
SANDHYA SINGH Avatar asked Jan 26 '26 04:01

SANDHYA SINGH


1 Answers

With a single BatchGetItem request the maximum number of items to get is 100, as documented by AWS:

A single operation can retrieve up to 16 MB of data, which can contain as many as 100 items.

[…]

Important

If you request more than 100 items, BatchGetItem returns a ValidationException with the message "Too many items requested for the BatchGetItem call."

There is also no pagination available as it is for actions like Query. What you could do is to implement pagination yourself so you make one BatchGetItem request per 100 items. If you go down this route, you should also make sure to properly handle the UnprocessedKeys.

While it's not clear what your use case for fetching more than 100 items at once from DynamoDB is, your problem could be a sign for a poor DynamoDB schema design. Depending on your use case redesigning your schema and/or using an action like Query might be a better choice.

like image 167
Dunedan Avatar answered Jan 29 '26 03:01

Dunedan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!