Fix exclude filter query performance (#1815)

* Fix query performance
* Reorder changelog changes by size to prepare for release
This commit is contained in:
kermieisinthehouse
2021-10-10 08:02:26 +00:00
committed by GitHub
parent 04ca11e62e
commit c31c7c3c99
3 changed files with 15 additions and 14 deletions

View File

@@ -211,7 +211,7 @@ func getMultiCriterionClause(primaryTable, foreignTable, joinTable, primaryFK, f
} else if criterion.Modifier == models.CriterionModifierExcludes {
// excludes all of the provided ids
if joinTable != "" {
whereClause = "not exists (select " + joinTable + "." + primaryFK + " from " + joinTable + " where " + joinTable + "." + primaryFK + " = " + primaryTable + ".id and " + joinTable + "." + foreignFK + " in " + getInBinding(len(criterion.Value)) + ")"
whereClause = primaryTable + ".id not in (select " + joinTable + "." + primaryFK + " from " + joinTable + " where " + joinTable + "." + foreignFK + " in " + getInBinding(len(criterion.Value)) + ")"
} else {
whereClause = "not exists (select s.id from " + primaryTable + " as s where s.id = " + primaryTable + ".id and s." + foreignFK + " in " + getInBinding(len(criterion.Value)) + ")"
}