←back to thread

149 points rbanffy | 2 comments | | HN request time: 0.416s | source
1. tmarice ◴[] No.42154924[source]
If you're on Postgres, StringAgg and ArrayAgg are nice alternatives to prefetch_related to avoid building Python model instances and waste memory.

I wrote a short blog post on recent optimizations we did on our Django codebase: https://tmarice.dev/blog/better-living-through-optimized-dja...

replies(1): >>42156257 #
2. rudasn ◴[] No.42156257[source]
Nice post,thanks for sharing!

It would be nice to include the generated sql queries along with the code samples though. I've been on a similar path recently and being able to see the queries was really helpful (even the ones that failed!).