Your suggestion about iterator is just what I was looking for!
values_list() is also good to know about.
Many thanks!
On Dec 28 2008, 10:39 pm, "join.toget...@gmail.com"
wrote:
> Three things:
>
> 1:http://docs.djangoproject.com/en/dev/ref/models/querysets/#iterator
>
> 2: What you're trying to
Three things:
1: http://docs.djangoproject.com/en/dev/ref/models/querysets/#iterator
2: What you're trying to do can be done much more efficiently the
following way: sum(SomeModel.objects.all().values_list('value'))
3: django 1.1 will have aggregation support, meaning you won't even
need to do
I don't have the answer to the cache question, but ...
you can of course use SomeModel.objects.values('value')
http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-fields
or get the db to sum(value) it (most efficient)
-fx
On Wed, Dec 24, 2008 at 6:42 PM, garyrob wrote:
>
> I
Or, if the issue is at least partly due to buffering for efficiency in
communicating between django and the database engine, is there a way
to choose to have smaller buffers?
On Dec 24, 12:42 pm, garyrob wrote:
> I am getting the impression that when I do a django database query
> that iterate
I am getting the impression that when I do a django database query
that iterates through all the rows of the table, django stores every
model instance in memory.
For instance, just doing
sumValues = 0
for someModel in SomeModel.objects.all():
sumValues += someModel.value
print sumValues
ca
5 matches
Mail list logo