• Tom Politowski
  • NEWBIE
  • 0 Points
  • Member since 2014
  • CEO
  • A4 International

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Batch Apex query on EmailMessage times out. Only 1M records in database. Query from Developer Console times out at 'LIMIT 10000'. Other queries on other objects with large 1M+ records work without issue. 
Code:
String query = 'SELECT Id FROM EmailMessage';

    global Database.querylocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }   

How can I create query to return all records? Tried adding 'WHERE IsDeleted = false' - still times out.
Batch Apex query on EmailMessage times out. Only 1M records in database. Query from Developer Console times out at 'LIMIT 10000'. Other queries on other objects with large 1M+ records work without issue. 
Code:
String query = 'SELECT Id FROM EmailMessage';

    global Database.querylocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }   

How can I create query to return all records? Tried adding 'WHERE IsDeleted = false' - still times out.