ACR Rules

  1. Home
  2. Docs
  3. ACR Rules
  4. Performance (29)
  5. Positive conditions should be preferred when retrieving data

Positive conditions should be preferred when retrieving data

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]