Also, take strong notice of this part: EXAMPLE: >>> _t = time.time(); x = map(lambda x: x, Post.objects.filter(id__gte=400000, id__lt=400500).all()); print "Took %ss"%(time.time() - _t) Took 0.0467309951782s >>> _t = time.time(); _res = map(lambda x: x, Post.objects.all()[400000:400500]); print "Took %ss"%(time.time() - _t) Took 1.05785298347s >>>
On Sun, Feb 20, 2011 at 10:35 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Also, this snippet isn't directly related, but it does show the methods we > used to paginate through 50 million rows, with query times of below 0.5 > seconds :) It uses the same method that was in my first suggestion (the ID > max thing) > > http://djangosnippets.org/snippets/2277/ > > Cal > > On Sun, Feb 20, 2011 at 10:26 PM, <delegb...@dudupay.com> wrote: > >> That would have been my approach if I were to do that. So, we are now two >> seeking the good way to get it done. >> Hello People, >> Galago and I have the same challenge, please help us. >> >> Sent from my BlackBerry wireless device from MTN >> ------------------------------ >> *From: * galago <prog...@gmail.com> >> *Sender: * django-users@googlegroups.com >> *Date: *Sun, 20 Feb 2011 14:24:37 -0800 (PST) >> *To: *<django-users@googlegroups.com> >> *ReplyTo: * django-users@googlegroups.com >> *Subject: *Re: Select x random rows from DB >> >> If i knew what is a good idea, I wouldn't aks here:D >> I only know - that described method is DB killer :) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.