In life many times simple things pose to be more nagging. Thinking of it why would salesforce be any different? In a age of "Lighting" , "Heroku" and "Mobility" there are minor things on the salesforce platform which might test our nerves. One such trifling issue is getting errors of non-selective query against large objects . We keep raking our heads why it keeps coming (as our memory is not always reliable that we had encountered it earlier too).
Error encountered : System.QueryException: Non-selective query against large object type (more than 100000 rows).
Lets ponder on this a bit!
What is a selective Query as against non-selective query?
What is Large Object Type?
Object having records in excess of 99999
- Consider an indexed filter
- Contact salesforce.com about custom indexing.
One will need indexes for all of the fields one is using if SOQL . This means that fields in filter must all be marked as External ID or have custom indexes created.Failing that, one may want to use SOSL, because the search indexer (not to be confused with a database index) will include all of the filter fields in the search.