Opened 16 years ago
Closed 10 years ago
#11280 closed Cleanup/optimization (wontfix)
model.m2m = [pk, list] Performs unnecessary SELECT
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Normal | Keywords: | m2m, bulk |
Cc: | cmawebsite@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.
Change History (6)
comment:1 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Cleanup/optimization |
comment:3 by , 13 years ago
UI/UX: | unset |
---|
comment:6 by , 10 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
To be clear: if we fix #6707 (which we should do), we shouldn't fix this ticket, so I think we should close in the meantime. Feel free to reopen if anyone thinks we should fix this anyway in the meantime.
Note:
See TracTickets
for help on using tickets.
Change UI/UX from NULL to False.