+ Start a Discussion

Reg:system.queryexception Non-Selective query with large object type

Have trigger to check duplicate with certain parameters



Query is:


(Select id from x__c where (((a__c = request.a__c) and (b__c =request.b__c) and (c__c = request.c__c) and (lastmodifieddate>=system.today) limit 1);


X__c is the object having 1,75,000 records. For satisfying this condition, its having only 5 records,


The same query, ran in the developer console,controller its running successfully.


When i run this query in the trigger, its throwing error.


Could any one help on this? Please..:(




Thanks for you reply,


But we dont have any external Id for the filtered fields.. Then how to resolve this.


you can turn it on at the field level, but if it's in prod you need to work with salesforce support.

It might help us if you let us know what the error is too.