Basic Issue: Missing Database Query Optimization (N+1 Query Problem)
Use case
Description: The codebase lacks systematic use of select_related() and prefetch_related() for database query optimization. While I found one instance in the Routine.date_sequence method with proper prefetching, this pattern isn't consistently applied across the application.
Proposal
Impact: This causes N+1 query problems where the application makes multiple database queries instead of optimized joins, severely impacting performance when displaying lists of exercises, routines, or nutrition data.
Value: Implementing proper query optimization could reduce database load by 70-90% and significantly improve page load times, especially for users with large datasets.
Additional Context
No response
I am starting to work on it