Skip to main content
added 96 characters in body; edited tags
Source Link
Samuel De Rycke
  • 9.6k
  • 8
  • 46
  • 73

I m getting the following error in a trigger.

Error:Apex trigger ContactSumTrigger caused an unexpected exception, contact your administrator: ContactSumTrigger: execution of AfterUpdate 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.ContactSumTrigger: line 95, column 1

Error:Apex trigger ContactSumTrigger caused an unexpected exception, contact your administrator: ContactSumTrigger: execution of AfterUpdate 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.ContactSumTrigger: line 95, column 1

The code at that place is : List ContactCountByAcc = [Select AccountId Acct, count(Id) RecCount from Contact where AccountId in :AccIds and GE_HQ_CONTACT_STATUS__c != 'Inactive' group by AccountId ];

 List<AggregateResult> ContactCountByAcc = 
       [SELECT AccountId Acct, count(Id) RecCount 
        FROM Contact 
        WHERE AccountId in :AccIds AND GE_HQ_CONTACT_STATUS__c != 'Inactive' 
        GROUP BY AccountId ];

AccIds do not contain any null values.

I m getting the following error in a trigger.

Error:Apex trigger ContactSumTrigger caused an unexpected exception, contact your administrator: ContactSumTrigger: execution of AfterUpdate 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.ContactSumTrigger: line 95, column 1

The code at that place is : List ContactCountByAcc = [Select AccountId Acct, count(Id) RecCount from Contact where AccountId in :AccIds and GE_HQ_CONTACT_STATUS__c != 'Inactive' group by AccountId ];

AccIds do not contain any null values.

I m getting the following error in a trigger.

Error:Apex trigger ContactSumTrigger caused an unexpected exception, contact your administrator: ContactSumTrigger: execution of AfterUpdate 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.ContactSumTrigger: line 95, column 1

The code at that place is :

 List<AggregateResult> ContactCountByAcc = 
       [SELECT AccountId Acct, count(Id) RecCount 
        FROM Contact 
        WHERE AccountId in :AccIds AND GE_HQ_CONTACT_STATUS__c != 'Inactive' 
        GROUP BY AccountId ];

AccIds do not contain any null values.

Source Link
sunny
  • 1.4k
  • 6
  • 26
  • 49

Non Selective Query issue

I m getting the following error in a trigger.

Error:Apex trigger ContactSumTrigger caused an unexpected exception, contact your administrator: ContactSumTrigger: execution of AfterUpdate 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.ContactSumTrigger: line 95, column 1

The code at that place is : List ContactCountByAcc = [Select AccountId Acct, count(Id) RecCount from Contact where AccountId in :AccIds and GE_HQ_CONTACT_STATUS__c != 'Inactive' group by AccountId ];

AccIds do not contain any null values.