python - Iterate over large collection in django - cache problem -
i need iterate on large collection (3 * 10^6 elements) in django kind of analysis can't done using single sql statement.
- is possible turn off collection caching in django? (caching data not acceptable data has around 0.5gb)
- is possible make django fetch collection in chunks? seems tries pre fetch whole collection in memory , iterate on it. think observing speed of execution:
iter(coll.objects.all()).next()
- takes foreveriter(coll.objects.all()[:10000]).next()
- takes less second
use queryset.iterator()
walk on results instead of loading them first.
Comments
Post a Comment