function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OnkiOnki 

Strange Error :

 

Error:Apex trigger Lead caused an unexpected exception, contact your administrator: Lead: 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): Class.LeadPopulateExistingRelatedObjectFlags.populateFlags: line 71, column 14

 

set<String> T = new Set<String>();

             T.add(test.com');

            

             for(Lead leadObj : [select id,email from lead where isConverted=false and  email_domain__c in : T and Id not in : currnetLeadId  limit 100])

             {      

                  emailLeadMap.put(leadObj.email,true);   

             }

and  email_domain__c Is formula filed for testing I am passing single value using T. In my system only 2 records with “test.com”.

 

Anyone can help me why this error is coming if record is only 2.

Ankit AroraAnkit Arora

This is really strange, as you have also applied the limit in query.

 

I have some reference to go with have a look, but it doesn't seems to help you : 

 

http://boards.developerforce.com/t5/Apex-Code-Development/Non-selective-query-against-large-object-type/td-p/276637

 

Are you sure you have only 2 records lead? If you have more than 100000 records than you need to put a field which is marked as external Id or you must filter out null.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page