Optimize performance with select_related