News for hackers. Stuff that matters.
Re:Ban 1+N in Django by lr4444lr on Sunday March 26, 2023 @05:34PM (#35319875)
I don't disagree with the author in principle, but I find once the data gets big enough where it makes a difference, I've already shifted to using ".values()" to avoid the overhead of model creation, and the KeyErrors that will throw if I leave the query lazy is tantamount to the solution he describes.
Re:Ban 1+N in Django by Suor on Sunday March 26, 2023 @09:12PM (#35321704)
I usually use `.values()` and `.values_list()` only when model creation is really slow. Usually many rows fetched.
Re:Ban 1+N in Django by sgt on Monday March 27, 2023 @06:25AM (#35324906)
Same, and using raw queries too when needed. Identify hot spots and do those. Regular ORM is fine for the rest (mostly).