simplified queries a bit
Finished query optimization. Finally found the correct solution which involves usign prefetch_selected across multiple models.