﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29081	"Clarify QuerySet.select_related() example regarding ""hitting the database"""	Дилян Палаузов	nobody	"[[Image()]]https://docs.djangoproject.com/en/2.0/ref/models/querysets/#select-related says:

> … then a call to Book.objects.select_related('author_ _hometown').get(id=4) will cache the related Person and the related City:
{{{
b = Book.objects.select_related('author_ _hometown').get(id=4)
p = b.author         # Doesn't hit the database.
c = p.hometown       # Doesn't hit the database.

b = Book.objects.get(id=4) # No select_related() in this example.
p = b.author         # Hits the database.
c = p.hometown       # Hits the database.
}}}

This leaves the impression, that the first snipped does not hit the database and the second snippet hits twice the database.

I propose:
* wring after {{{b = Book.objects.select_related('author_ _hometown').get(id=4)}}} the comment # Hits the database with INNER JOIN.
* changing {{{b = Book.objects.get(id=4) # No select_related() in this example.}}} to {{{b = Book.objects.get(id=4) # No select_related() in this example, hits the database.}}}"	Cleanup/optimization	closed	Documentation	2.0	Normal	fixed	select_related		Accepted	1	0	0	0	0	0
