On Saturday, January 22, 2011 1:38:22 PM UTC, maraujop wrote:
>
> Hi everyone,
>
> I have been working on reducing DB queries in my project with great 
> results. But I have realized that select_related in one of my models doesn't 
> preload all the ForeignKeys and OneToOneFields, it preloads 3 out of 5. 
> Actually the 3 preloaded are ForeignKeys and the other 2 are OneToOneFields. 
> Before trying to reproduce this problem in a simplified schema, I need 
> someone to confirm this is unusual.
>
> If I do a select_related('names', 'of', 'the', 'five', 'fks') everything is 
> loaded. Last thing I can say is that those OneToOneFields point models that 
> reference back to model pointing at them, for performance reasons. I reckon 
> this can be a bug.
>
> Thanks, best regards
>
> ----
> Miguel Araujo
> @maraujop
>

It would have helped if you'd posted your model. If your relationships are 
defined as null=True, then select_related() doesn't follow them unless you 
specify them explicitly.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to