+ Start a Discussion

Users are unable to edit records


My users are unable to edit any record. They are getting error:

Error:Apex trigger trgLead caused an unexpected exception, contact your administrator: trgLead: execution of BeforeUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Trigger.trgLead: line 25, column 1
This happens when custom code is not built for scalability. A SOQL query that has worked previously is suddenly failing becuase the total # of records on the table (not the total being retrieved) has reached over 100,000 records and the WHERE clause of the query is not filtering on an indexed field.

Locate the object that is over 100000 records, find that query, and figure out how to use indexed fields for your use case.  If it's a custom field you are filtering on, then consider setting that field to also be an "External ID" which salesforce will index.

This is a multi-tenant performance governor limit here, salesforce does not want poor performing queries to hog resources when they should be indexed queries anyway.


Related answers: