RowCount for DynamoDB

0

Customer that is looking for the most efficient way to get a item count from dynamoDB

QUERY method and then count individual records (the issue here is it’s a paginated method so we might have to count incrementally)

SCAN and use the count returned (Scan would be slow?)

demandé il y a 5 ans18560 vues
2 réponses
0
Réponse acceptée

The most efficient way to get an item count from DynamoDB Query operation is to use Select COUNT request parameter. This allows you to answer questions such as: how many items there are for the given partition key with the sort key in the given range, where the range can change from one request to another. Questions like this cannot be answered by keeping a running count, as you can't keep the count for every possible range. The query performance as well as cost will depend on the number of items scanned, so they would need to test to find out if the latency and cost are acceptable for their use case.

The running count approach works well for deterministic queries and aggregates, such as the total count for a table, or key, for example. This approach can be implemented with DynamoDB triggers which consist of a stream on the table with a Lambda function doing the aggregation and storing the aggregates to another DynamoDB table, for example.

AWS
répondu il y a 5 ans
0

One of the ways to get the total item count is to use "DescribeTable" API and use the "Table.ItemCount" response attribute.

Note: This might give stale results as the data is updated approximately every six hours.

AWS
Deep
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions