Asking for Guidance

0

I have started exploring the possibilities of DynamoDB.
I'm building an application which includes the need of listing all Items. I've read that scans are expensive operations at DynamoDB and I understand this. My question is that, then how should we list all items to "do it in the dynamo way"?

My example:
Let's say I have 800 items, each of them 0.5KB. That's 400KB. That means 100 RCUs if I understood correctly. Which costs $36.60 / year in Frankfurt. This price is not bad, but what if I had 8000 items? I'm sure there's a better way to do this.

Best,
Markus

demandé il y a 5 ans191 vues
1 réponse
0
Réponse acceptée

Hello Markus,

If you have a requirement to list all items in DynamoDB, scan is the correct approach to proceed. You could also consider caching the list if there aren't frequent changes to your data.

Scan is expensive as compared to Query or GetItem operations because it reads the entire table, as opposed to Query/GetItem which only reads data pertaining to a specific partition key.

We recommend using Query rather than Scan only in case the partition key's value is known. You could draw an analogy in terms of MySQL as follows:
running select * with a where clause = query
running select * = scan

I hope this helps address your question.

AWS
répondu il y a 5 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