psychorama
psychorama

Reputation: 323

Does AWS DynamoDB API pose a limit to number of records returned in a secondary index query?

I'm woking with DynamoDB using java SDK. The case here is, that I've a secondary index which when queried might contain 1000+ records in the returned result. I'm not sure if DynamoDB returns the result in a paginated form or all records at once?

Thanks.

Upvotes: 3

Views: 1603

Answers (2)

Eyal Ch
Eyal Ch

Reputation: 10056

Dynamodb paginates the results

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#Pagination

DynamoDB paginates the results from Query and Scan operations. With pagination, Query and Scan results are divided into distinct pieces; an application can process the first page of results, then the second page, and so on. The data returned from a Query or Scan operation is limited to 1 MB; this means that if the result set exceeds 1 MB of data, you'll need to perform another Query or Scan operation to retrieve the next 1 MB of data.

If you query or scan for specific attributes that match values that amount to more than 1 MB of data, you'll need to perform another Query or Scan request for the next 1 MB of data. To do this, take the LastEvaluatedKey value from the previous request, and use that value as the ExclusiveStartKey in the next request. This approach will let you progressively query or scan for new data in 1 MB increments.

Upvotes: 4

rpmartz
rpmartz

Reputation: 3809

Yes, DynamoDB paginates the results. From the AWS DynamoDB Docs:

DynamoDB paginates the results from Query and Scan operations. With pagination, Query and Scan results are divided into distinct pieces; an application can process the first page of results, then the second page, and so on. The data returned from a Query or Scan operation is limited to 1 MB; this means that if the result set exceeds 1 MB of data, you'll need to perform another Query or Scan operation to retrieve the next 1 MB of data.

Upvotes: 1

Related Questions