📜  django 模型中的总和值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:07.533000             🧑  作者: Mango

代码示例1
sum_a = sum([item.column for item in queryset]) # Definitely takes more memory.
sum_b = queryset.aggregate(Sum('column')).get('column__sum') # Takes about 20% more time.