Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find Average and Total sum in DynamoDB?

enter image description here

How can I get sum and average of packSOC and totalKw?

I am using dynamoDB as database but in my understanding dynamoDB does not support aggregate. How can I get average and sum of packSOC and totalKw.[Not possible to use for loop on result because result has so many data in it].

like image 338
sohamdodia Avatar asked Sep 14 '25 10:09

sohamdodia


1 Answers

At this time DynamoDB doesn't support this aggregation features.

If you want to collect these values you either have to keep track of them elsewhere or do the very inefficient collection scan and calculate it. Even if you reduce the output using projections that's likely not feasible.

If you need such functionality DynamoDB might not be a good pick for you and you should look at similar databases like MongoDB which does have a powerful aggregation framework. They do offer a cloud hosted version as well called MongoDB Atlas

like image 136
Udo Held Avatar answered Sep 17 '25 05:09

Udo Held