I am currently working with DynamoDB with Java and using DynamoDBMapper. I saw that when we use DynamoDBQueryExpression we can use either PaginatedQueryList or QueryResultPage. If we are using any of them below are the methods we have to use,
query method - returns a [PaginatedQueryList][1]
queryPage method - returns a [QueryResultPage][1]
PaginatedQueryList says it will first load 1MB of data and if we iterate over then it will load next page if needed and also this is paginated. But what about QueryResultPage? It says it is loading 1MB of data. But what about if we iterate it? Will it load the second page or just only give us 1MB of data? I couldn't find anything about that? And also QueryResultPage gives us the LastEvaluatedKey but PaginatedQueryList not. So is there a way to get the LastEvaluatedKey in PaginatedQueryList or else if we need to get that key do we have to always use the QueryResultPage?
And also instead of the following code,
PaginatedQueryList<Data> data = dynamoDBMapper.query(Data.class, queryExpression);
If we use the following,
List<Data> data = dynamoDBMapper.query(Data.class, queryExpression);
data.size();
Will it load the all data found in DB? What if I use stream() instead of data.size() will it load all?