Using a negative condition (e.g. not
and !=
) in a database retrieve is slower than using a positive one. This is because negative queries do not let the database to use indices since it is not possible to index what is not there.
Where possible formulate logic in a positive way.
Noncompliant example:[EnumAttribute != Module.Enumeration.C]
Compliant example:
[EnumAttribute = Module.Enumeration.A or EnumAttribute= Module.Enumeration.B]