Actually, using order_by('?') is the worst thing possible, especially in a largish db in production.
Why? That query generated is SELECT .... FROM .... WHERE .... ORDER BY RAND() LIMIT N where the random function is executed for every row in the result set which is ordered by the generated value. As I'm sure you can imagine, running this on a medium sized db table will be _slow_ Check out https://stackoverflow.com/questions/962619/how-to-pull-a-random-record-using-djangos-orm for better options -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e6505c0f-1186-493b-b0c2-af8881663183%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.