Hacker News new | ask | show | jobs
by pryelluw 242 days ago
People generally don’t take the time to learn the framework and miss out on the tooling it provides. select_related for example. If I had a dollar for every project I’ve been hired to work on that didn’t use it, well, I actually do.

Also, people in general don’t seem to be able to do more than very basic SQL, so creating views is seen as a little known performance “trick”.

In general, people who don’t read the manual.

2 comments

FYI you can avoid the manual sprinkling of select_related somewhat with https://pypi.org/project/django-auto-prefetch/, which avoids the lowest hanging N+1 loops automatically. Definitely not a cure all but it helps.
Customers who like django-auto-prefetch may also like django-zeal: https://pypi.org/project/django-zeal/
Yes, aware of this option. Thanks for posting it!
Ah yes. That’s the one thing I need to teach everyone when they’re new to Django. I was wondering if there were other quirks to the ORM beyond avoiding N+1 queries.