javamavenamazon-dynamodbguice-3

Dynamodb Range query gives limited number of results


I'm trying to implement application using google guice framework with dynamodb database. I have implemented API for finding documents by range query the result set is not updating with new records. The number of records are always same. How we can solve this problem?


Solution

  • The response of dynamodb is limited to 1mb per page. Also when your resultset is bigger, you only get the first results till response size is 1MB.

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

    Is described how to use the meta data of the response to see real amount of results, starting index and so on. To query the hole result in batches / pages.

    Important excerpt of the docs:

    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 will let you progressively query or scan for new data in 1 MB increments.

    When the entire result set from a Query or Scan has been processed, the LastEvaluatedKey is null. This indicates that the result set is complete (i.e. the operation processed the “last page” of data).