Query Error: "System.QueryException: Non-selective query against large object type"

To avoid "Query Error: "System.QueryException: Non-selective query against large object type"" exception, follow the below steps

1. Make sure that your SOQL doesn't have null values in set or list or in a variable while fetching.

2. Don't use negative operator such as NOT EQUAL TO (or !=), NOT CONTAINS, and NOT STARTS WITH in SOQL to fetch records.

3. Avoid using Formula field for filtering in SOQL.

4. If you use IN operator, make sure that the field is indexed.

5. If a field is not indexed, kindly contact Salesforce.com to do custom index on the field.

6. Empty your Organization Recycle Bin.


1. By default, Lookup, Master Detail and external id fields are indexed.

2. For custom indexing, kindly contact Salesforce.com support.

Check this link for more info