Skip to main content

Non-selective SOQL queries on large objects

David Martin avatar
Written by David Martin
Updated today

When querying large objects, non-selective queries take a very long-time and may cause different programmatic elements (such as Apex triggers or batch Apex classes) to fail.

Large objects configuration

This rule works with special objects configured on each project.

Project leads can manage special objects and configure any required indexed fields:

  1. Go to Project > Settings

  2. Then select Application objects

  3. Enter the name of the object

  4. Edit the object and check the Large data volumes toggle

  5. Add any indexed fields

  6. Click Preview to know if there are scans are affected by this change

  7. Click Update to confirm

Use this check as part of the review process

As this rule is not part of any Clayton default Skill, it requires a custom Skill to be used within code reviews:

  1. If there's already a custom Skill ready to be used for this rule, then go to step 2 otherwise, create a new Skill as described here

  2. Add the Non-selective SOQL queries on large objects rule to the Skill

  3. Configure the desired severity

  4. Finally, Publish the new Skill to make it available for projects

Note: Make sure to have configured large data objects on your projects (Project > Settings > Application objects) before launching new scans.

Did this answer your question?