﻿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
10399	Optimise cross-table update for one-to-one fields	Malcolm Tredinnick	Simon Charette	"When we do an update involving a `OneToOneField` (model inheritance cases being an obvious example), the update queryset does something akin to `filter(pk__in=inner_query)` where `inner_query` describes the child model. However, the field in this particular case is known to be one-to-one, not many-to-one. So the reverse relation will only match one item. Thus, we might as well do `filter(pk=some_value)`, which is much faster.

Detecting this case can probably be handled in `UpdateQuery.add_update_fields()` in some fashion, I suspect.

(This is another one of those long-term SQL optimisation projects that I'll get to at some point. Making a tracking bug for it, since it's been floating around for a while.)"	Cleanup/optimization	closed	Database layer (models, ORM)	1.0	Normal	fixed			Ready for checkin	1	0	0	0	0	0
