I have my own custom code(before insert trigger) for check on Dead Leads. for storing dead Leads there is a custom object. Currently the custom object has more than 200000 records. Due to large number of records, while querying against the custom object, i am getting the following exception.
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
Can we handle this exception using some custom code or can we handle this issue in pure salesforce way.
following is the query being used
for(Dead_Leads__c ld:[select unique_Id__c from Dead_Leads__c where unique_Id__c IN :UnqIdSet])