Find Average and Total sum in DynamoDB?

Deadly 提交于 2021-01-27 20:30:24

问题


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].


回答1:


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



来源:https://stackoverflow.com/questions/46196282/find-average-and-total-sum-in-dynamodb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!