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
Salesforce Admin09823787045252064Salesforce Admin09823787045252064 

Apex governor limit warning

Hi all,

I'm getting the following error email:

Caused the following Apex resource warnings:

Approaching limit for non-selective query against large object type (more than 100000 rows). Current size is approximately 75190 rows. When the limit is reached, the query will fail. 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)
null
Approaching limit for non-selective query against large object type (more than 100000 rows). Current size is approximately 75190 rows. When the limit is reached, the query will fail. 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)
null

(these emails can be disabled from the user detail page for this user)

However, it doesn't seem to offer any details as to what is causing this exactly. I see that it's a upsert on Task, but doesn't provide any other information. What is best way to track down this error?

Thanks!
Kiran  KurellaKiran Kurella
Check out the following link for more details. You may need to add a custom index or modify your query as suggested below.

http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm
Salesforce Admin09823787045252064Salesforce Admin09823787045252064
Thanks! I think I understand the potential solutions, but the email doesn't seem to offter any hints as piece of code (trigger, classes) is actually causing the problem. I can see it's an upsert of tasks, but, as we have a variety of task triggers, I'm not sure which one is causing the problem.