You need to sign in to do that
Don't have an account?
tonante
System.QueryException: Non-selective query against large object type (more than 100000 rows).
Hi, I get this error but the difference is that my SOQL queries actually return a value. I make sure they are of size limit 1 or no greater than 4 in the ones which were flagged as errors. I have not deployed code in nearly 1.5 months , at 78% code coverage, and just last Thursday our SFDC Admin was attempting to deploy workflows using change sets and suddenly got 25 of these "Non-selective query" errors. None of the 25 errors have SQOL queries that return Null because the queries use no variables in the WHERE clause. Here is a sample of the SOQL code issues I am having: The "Non-Selective query" error occurs at the last query within this code segment.
Here is the Production Workbench Query Result from the last query of the code above. Thanks much for your help.:
@isTest (seeAllData=true) public class TestOpportunityAfterUpdate { public static testmethod void TestAdvocacyShipCharge(){ AdvocacySupplyShipCharge_Test.TestAdvocacySupplyShipCharge(); } public static testmethod void TestMozoAccounts(){ List<Opportunity> Orders = new List<Opportunity>(); Set<Id> contactIds = new Set<Id>(); List<Id> orgIds = new List<Id>(); User ouser = [SELECT Id from User where Name = 'Awana Applications' limit 1]; RecordType rec = [Select Id from RecordType where SObjectType = 'Opportunity' and Name = 'Orders']; Map<Id,Opportunity> mozoMap = new Map<Id,Opportunity>(); List<Account> accts=[Select Id, Default_Shipping_Address__c, Mailing_Address_Book__c,Registration_Level__c, Registration_Status__c, Date_Inactive__c,ShippingStreet,ShippingCity,ShippingState,ShippingPostalCode,ShippingCountry from Account WHERE RecordType.Name = 'US Organization' and Date_Inactive__c <> null and Account_On_Hold__c = false and RecordType.Name in ('Canada Church','US Organization') limit 4]; system.debug('<< ACCOUNTS>> '+accts); for(Account acct : accts){ orgIds.add(acct.Id); }
Here is the Production Workbench Query Result from the last query of the code above. Thanks much for your help.:
1. Filter by an Index field, like CreatedDate or Id etc or any external id field
2. As this is test class you could resolv it by making seeAllData=false instead of seeAllData=true, in case if you want some results from this query than you should create Account record in test class it self instead of using Organization data.
Thanks
Shashikant
Thanks
Shashikant
Thanks
Shashikant