﻿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
11320	Over aggressive join promotion with exclude()	Alex Gaynor	nobody	"Currently filter() optimizes it so that when you create a query such that a relation must exist it uses an INNER JOIN, since that's faster than an OUTER JOIN.  However with exclude() a query such as:

{{{
#!python
class MyModel(models.Model):
    venue = models.ForeignKey(""Venue"", null=True)

MyModel.objects.exclude(venue=None).exclude(venue__name='a')
}}}

For this query it should be using an INNER JOIN but instead uses a LEFT OUTER JOIN."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
