6 ms·
We still use the ORM for most things. If you know how to use it right, you can make your queries pretty efficient. I'm not claiming this is the best solution, b
by mattrobenolt 13y ago
We still use the ORM for most things. If you know how to use it right, you can make your queries pretty efficient. I'm not claiming this is the best solution, but it works. It takes patience and understanding to use efficiently and make sure you're not using excessive amounts of queries. Specifically avoiding O(n) queries. Which are easy to achieve in Django.
- bliti 13y agoYeah, it really depends a lot on the models, too. If you go FK crazy then you push the ORM into making weird joins all the time. Which kills performance. Do you run the actual ORM commands or pass raw SQL to it?
- mattrobenolt 13y agoWe do a mix of both, but mostly the actual ORM methods.
- hardwaresofton 13y agoSo this is kind of exactly what I witnessed in real life -- a friend of mine who uses Django for his stack had essentially a nested O(n^2) query, because of the ease with which the ORM allows you to query things as if they were objects in memory... Needless to say, this was very bad, and we both knew it, but it took some digging to find the right django code to implement it (we knew what we WANTED to do, and could write it out in SQL) This particular friend was using the django testing middleware, and even with the massive amount of queries he was doing to the database, the database was not the biggest slowdown (each query went in quick, came out quick), the marshalling he was doing on the django side was...