I’ve legacy code of a Django apps that I need to optimize for better viewing. I have moved some of the heavy loading of data in templates by using
Django Rest Framework endpoints that provide
But nevertheless, the applications kept feeling slow. So I started the optimization route. I firstly implemented caching, but lately I discovered how to optimize SQL queries (especially the extra duty tasks that might be done on DRF
SerializerMethodField !) using
It’s been a huge improvement of my queries where I’ve seen for example, specs going from 110 Queries in 57.34Ms to 5 Queries in 10MS. I’ve used this tutorial.
But Django Debug Toolbar still shows me that there are some queries that are still duplicates/redundant. So a proper blog/tutorial on optimizing queries may be useful.