K.Liu
K.Liu

Reputation: 281

Questions on dynamoDB query result

I'm currently thinking about how I should write my queries for DynamoDB. I have questions below which I hope someone could advise me on it.

Given scenarios: I have a million records on a table.

Questions:

  1. When I query, can I fetch 1000 records in batches instead of 1 million records at one go?

  2. Is the time taken to fetch 1000 records similar to 1 million records?

  3. What happens if I hit the limit of 1MB or my throughput for the table so that I can fetch again for the remaining records?

Thanks in advance!

Upvotes: 4

Views: 1183

Answers (1)

Mircea
Mircea

Reputation: 10566

1) Yes you can specify a limit for a query (1000 in your case).
2) No. The time is not the same. More records will mean more time - because you will need to fetch more pages (most time will be spend in network roundtrips)
3) If you hit the 1MB limit, Dynamo will provide a LastEvaluatedKey. You repeat the request and pass the LastEvaluatedKey until you fetch everything (you are basically fetching in a loop).
If you hit the provisioned throughput limits, you either increase the limits or you back off (i.e. you need to regulate your consumption to stay within the limits)

Reference: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html

Upvotes: 4

Related Questions