﻿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
33154	The Exact lookup generates suboptimal queries for BooleanField on MySQL	Roman Miroshnychenko	Roman Miroshnychenko	"Currently `Exact` lookup uses ""shortcut"" condition syntax for `BooleanField`, that is `WHERE foo` or `WHERE NOT foo` instead of explicit syntax `WHERE foo = TRUE/FALSE` if `foo` is a BooleanField (`TINYINT(1)` in MySQL).
The problem is that with ""shortcut"" syntax MySQL query planner ignores DB indexes that include the field in question in contrast to explicit condition syntax, resulting in performance hit for ORM-generated SQL statements.

Proposed solution: Always use explicit comparison syntax in `Exact` lookup for `BooleanField` with MySQL as a DB backend, that is `WHERE foo = TRUE/FALSE` or even `WHERE foo = 1/0` since boolean is `TINYINT(1)` in MySQL."	Cleanup/optimization	closed	Database layer (models, ORM)	3.2	Normal	duplicate			Unreviewed	0	0	0	0	0	0
