You need to sign in to do that
Don't have an account?
Intellect Solutions
I'm having issues with the following error: Non-selective query against large object type (more than 100000 rows)
I´m receiving the following error: 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.OpportunityService.calculaPromedio: line 77, column 1Class.OpportunityTriggerHandler.OnBeforeUpdate: line 62, column 1Trigger.OpportunityTrigger: line 15, column 1
The previous error occurs on the object Opportunity when I do a consult.
Here is the method:
Any help will be appreciated.
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.OpportunityService.calculaPromedio: line 77, column 1Class.OpportunityTriggerHandler.OnBeforeUpdate: line 62, column 1Trigger.OpportunityTrigger: line 15, column 1
The previous error occurs on the object Opportunity when I do a consult.
Here is the method:
Any help will be appreciated.
That means your query is too long or taking CPU time(10sec) too much. I can suggest you to use @future call or implemet batch apex. Your method will work
asynchronous if you use future or batch.
Two more option;
You can try to use SOSL instead of SOQL. I dont know what the purpose of the class is but this may help you.
http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_sosl.htm
Or
You can put more criteria on you WHERE clause.
I hope this will help you.
Regards
Mert
Try by putting that query into forloop sql.
like:
for(AggregateResult ar:[select query])
{
}
another thing is
try to add more conditions in query. it will solve the problem