+ Start a Discussion

System.QueryException: Non selective query againt error


I have below error for a query,
System.QueryException: Non selective query againt large object type more thatn 200000
for this query
List<User> userList = [SELECT LDAPId__c FROM User WHERE TECH_LDAPId__c=: sLDAPId AND LDAPID__c != null AND IsActive=true];
how can i resovleve this, please
Best Answer chosen by Sandrine
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sandrine,

Please find the below artcile which shows the details why you face the error and also the suppose resolution for the same.

https://help.salesforce.com/s/articleView?id=000323572&type=1 (https://help.salesforce.com/s/articleView?id=000323572&type=1)

If this solution helps, Please mark it as best answer.