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

preguntada hace 5 años191 visualizaciones
1 Respuesta
0
Respuesta aceptada

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
respondido hace 5 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas