﻿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
11280	model.m2m = [pk, list] Performs unnecessary SELECT	Zulq Alam <me@…>	nobody	"When assigning a collection to an m2m relationship using a list of PKs an unnecessary SELECT is performed.

{{{
DELETE FROM model_m2m WHERE model_pk = %s
SELECT FROM model_m2m WHERE model_pk = %s AND m2m_pk IN (%s, %s, %s, ...)
INSERT INTO model_m2m (model_pk, m2m_pk) VALUES (%s, %s)
INSERT INTO model_m2m (model_pk, m2m_pk) VALUES (%s, %s)
etc...
}}}

The DELETE will remove any rows the SELECT might have found.
"	Cleanup/optimization	closed	Database layer (models, ORM)	1.0	Normal	wontfix	m2m, bulk	cmawebsite@…	Accepted	0	0	0	0	0	0
