You need to sign in to do that
Don't have an account?
Selective Query on Indexed Field but Resultset Larger than 10%
Hi,
I am running the following query in a trigger.
SELECT Id,Shipped_To__c FROM Transaction__c WHERE Shipped_To__c = '002A000000JVNJJ'.
Transaction__c is a custom object and Shipped_To__c is a lookup relationship to account object. The problem is that this query returns 30000 records (15%) and my object contains 200000 records.
Since this is higher than the 10% threshold, I tried to run this query in a loop by adding an additional filter on month name like this..
SELECT Id,Shipped_To__c FROM Transaction__c WHERE Shipped_To__c = '002A000000JVNJJ' and Month__c = 'January'. (Month__c is not an indexed field). This reduced the resultset size to 3000 which is well within the limits. However, I am still getting the "Non-selective query against large object type (more than 100000 rows)." error. My best guess is that the resultset has to be smaller than 10% based on indexed field only and not the combination of indexed and non-indexed. Has anyone encountered similar problem before and if yes what are my options to solve this problem. Appreciate any ideas on this...