#32143 closed Cleanup/optimization (fixed)
Use EXISTS to exclude multi-valued relationships
Reported by: | Simon Charette | Owned by: | Simon Charette |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The current logic that is invoked when excluding a multi-valued relationship (sql.Query.split_exclude
) pushes down the filtering criteria in a parent.id NOT IN (SELECT child.parent_id ...)
subquery.
These kind of operations can be really hard for some query planners to optimize and also tricky to get right due to how the IN
operator treats NULL
values which is something we've known for a while.
The NOT EXISTS
function should be used instead of NOT IN
.
Change History (5)
comment:1 by , 4 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 4 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Accepted → Ready for checkin |
comment:3 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
In 8593e162: