Re:Taming the beast that is the Django ORM – An introduction
by andybak on Sunday September 01, 2024 @04:58AM
(#41415353)
You have to use the ORM with a bit of awareness of the query it it generates. Django provides plenty of tools and great documentation for reducing, combining and managing queries. It's not like it's a deep dark corner.
It's like understanding memory allocation if you're writing c. It's just part of the job
It has happened that a dev in our team was populating an endpoint that used inheritance and when looking at the number of queries we were over 100.
But the solution in those cases is just OUTER JOINs and CASE. Especially since we use Postgres in the backend and it works so well.
So yes, there are some pitfalls, but they're greatly overshadowed by the advantages of the ORM.