Re: memory use in django database queries

2009-01-01 Thread garyrob
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 >

Re: memory use in django database queries

2008-12-28 Thread join.toget...@gmail.com
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

Re: memory use in django database queries

2008-12-24 Thread garyrob
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

memory use in django database queries

2008-12-24 Thread garyrob
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