Benjamin RD
Benjamin RD

Reputation: 12034

Get 'X' number of records on DynamoDB

I'm trying know if exist something similar to TOP in SQL on DynamoDB I'm reading the documentation http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html But I didn't find something similar. Someones knows a way to do it?

Upvotes: 1

Views: 4124

Answers (2)

Chen Harel
Chen Harel

Reputation: 10052

Limit in Scan/Query is what you were looking for

Upvotes: 1

Krease
Krease

Reputation: 16215

Both ScanRequest and QueryRequest have a withLimit function for limiting the maximum number of items to evaluate for a request.

From the documentation:

The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide.

Upvotes: 1

Related Questions