The first method is two separate database calls: one to find the Blog, and the second to get the Entry objects. However, each is a simple query with no JOINs.
The second method is only one query, but does a JOIN to find the entries related to the blog with that slug.
Which method you use depends on your use case. For example, if you already have the Blog, then calling entry_set
on it directly would be better, because then that's only one simple query. Whereas if you knew the blog ID, rather than the slug, then it would be better to do Entry.objects.filter(blog_id=my_blog_id)
, as then you're not doing a JOIN at all, so again one simple query.