You need to sign in to do that
Don't have an account?

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.
Morning,
I have been receiving this email stating the trigger i wrote on Accounts has to be indexed.
I have no idea on what is causing this issue.
Any help on this is apprecaited. Below is the snipet of the code and the error.
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)
if(MapAccount != null && MapAccount.keySet() != null){
list<Account> colAccounts = [select id,Client_Code__c,First_Trade__c,Reactivation_Date__c,Client_FTT__c from Account where Client_Code__c != null and Client_Code__c in : MapAccount.keySet()];
if(!colAccounts.isEmpty()){
for(Account objAccount : colAccounts){
if(objAccount.Client_Code__c != null){
MapAccountOpt.put(objAccount.Client_Code__c,objAccount);
I have been receiving this email stating the trigger i wrote on Accounts has to be indexed.
I have no idea on what is causing this issue.
Any help on this is apprecaited. Below is the snipet of the code and the error.
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)
if(MapAccount != null && MapAccount.keySet() != null){
list<Account> colAccounts = [select id,Client_Code__c,First_Trade__c,Reactivation_Date__c,Client_FTT__c from Account where Client_Code__c != null and Client_Code__c in : MapAccount.keySet()];
if(!colAccounts.isEmpty()){
for(Account objAccount : colAccounts){
if(objAccount.Client_Code__c != null){
MapAccountOpt.put(objAccount.Client_Code__c,objAccount);
You are already adding Client_Code__c in : MapAccount.keySet() not equal to null then there is no need to add
Client_Code__c != null. You need to remove this in order to make your query selective.
if(MapAccount != null && MapAccount.keySet() != null){
list<Account> colAccounts = [select id,Client_Code__c,First_Trade__c,Reactivation_Date__c,Client_FTT__c from Account where Client_Code__c in : MapAccount.keySet()];
if(!colAccounts.isEmpty()){
for(Account objAccount : colAccounts){
if(objAccount.Client_Code__c != null){
MapAccountOpt.put(objAccount.Client_Code__c,objAccount);