Activity Forums Salesforce® Discussions Query Exception

  • Query Exception

    Posted by Suyash on April 30, 2016 at 4:38 PM

    I got error “System.QueryException: Non-selective query against large object type (more than 100000 rows)” when i used in my prod environment. This is due to the no. of records in the org which are queried are about 3 lacs.What should be done in this case to counter this error. I am using query as leadlist=[select id from Lead where phone IN:phone] here phone is a standard field

    Gourav replied 10 years ago 2 Members · 1 Reply
  • 1 Reply
  • Gourav

    Member
    June 8, 2016 at 11:48 AM

    Yes, that means it’s taking too long. A couple ways to get more CPU time are to put the code in an @future method (you get 60 seconds of CPU instead of just 10 seconds), or implement it as a Batch Apex job. Since both of these methods are asynchronous, the trigger and associated DML will complete before the calls to the AccountServices methods are made – but they will be called eventually. Would this work for you? or Try to filter your query to reduce number of records.

Log In to reply.