Sadly I have to admit that I'm not involved with day to day development of our app anymore (I miss it tremendously). Yesterday I felt nostalgic and reviewed a few already-merged PRs, just "for fun" we could say. Great was my surprise when I noticed that one of those PRs was merged with an `order_by('?')`. We're (and we've always been) using Postgres, and I knew already that `ORDER BY RANDOM()` is very slow. I just submitted a comment and it's already been fixed, so it wasn't a big deal. But this got me thinking:
TLDR; Some less-experienced developers might not know the issues with `order_by('?')` (at least with Postgres, the only engine I'm familiar enough) and it's worth raising a warning. I don't know what's the state of other engines, it's maybe even worth raising the issue for ANY engine. It could help newcomers catch these issues early. The docs clearly state it <https://docs.djangoproject.com/en/3.0/ref/models/querysets/#django.db.models.query.QuerySet.order_by>, but not everybody reads the docs with such level of detail: Note: order_by('?') queries may be expensive and slow, depending on the > database backend you’re using PS: Sorry for the personal touch of this message, but I think it's worth the explanation. -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/fe948733-7767-4688-b89a-43fa57153905%40googlegroups.com.