I have a Set called set_pvCorporativo with about 600 values. I want to bring exactly 600 accounts that have the pv_Corporativo value in set_pvCorporativo AND the Status 'Ativo' in a query like:
List<Account> list_Accounts = [SELECT Id, PV_Corporativo__c
FROM Account
WHERE Status__c = 'Ativo'
AND PV_Corporativo__c IN :list_pvCorporativo];
But when I execute the query, I take the following error:
System.QueryException: Non-selective query against large object type (more than 200000 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)
I can't make this field unique, because there is more than one Account with the same PV_Corporativo, but I used the Status Ativo to filter the result. So with the status on the query, I have only one account for each value on the set. Can some one help me with this error?