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
NaishadhNaishadh 

System.QueryException: Non-selective query against large object type (more than 100000 rows)

Hi,

 

Following query line is generating

 

 

for (Lead l : [select Id, Email, HasOptedOutOfEmail, Spot_Profile__c, SPOT_Communication_Types__c, SPOT_Alternative_Investments__c,SPOT_Banks__c,SPOT_Benefit_Administration__c, SPOT_Brokerage_and_Clearance_Solutions__c,SPOT_Capital_Markets__c,SPOT_Consulting_Services__c, SPOT_Corporations__c,SPOT_Energy__c,SPOT_Enterprise_Solutions__c,SPOT_Institutional_Asset_Management__c, SPOT_Insurance__c,SPOT_Trading__c,SPOT_Wealth_Management__c,SPOT_Workflow_and_Business_Processing__c, SPOT_Global_Trading__c from Lead where isConverted != True and isDeleted != True and Email != null and Email in :profilesMap.keySet() limit :recordLimit for update]) { }

 

 following error.

 

 

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)

 

The same code is working fine for the same user in testMethod but shows above error during manual update through browser. Also code is working fine for Administratror profile. Please help!

 

 

NaishadhNaishadh
Any Suggestion! Please guide!
Philip_FPhilip_F