4

Been doing tests in sandbox in which I've created about a million accountshares that I need to get rid of for testing.

I'm trying data loader in bulk api mode to export than delete but I keep getting:

InvalidBatch : Failed to process query: QUERY_TIMEOUT: Your query request was running for too long. Trying again later.;

Not sure if I should be waiting longer? Any other options or dataloader configurations I should be looking at?

EDIT

I've been trying with batch apex jobs yet still having issues.

Script

string str='select id from AccountShare where lastmodifiedbyid =\'0050P000007Kfy2\' limit 10000';
sharedeletebatch bdt=new sharedeletebatch(str);
Database.executeBatch(bdt);
system.debug(bdt);

Batch

global class sharedeletebatch Implements Database.batchable<sobject>
{

     global final string query;
     global sharedeletebatch(string q){

          query=q;
     }

     global Database.QueryLocator start(Database.BatchableContext BC){

      return Database.getQueryLocator(query);
     }
     global  void execute(Database.BatchableContext BC,List<SObject> scope){
         delete scope;

    }
    global void finish(Database.BatchableContext BC){
    }


}

First error: [REQUEST_RUNNING_TOO_LONG] Your request was running for too long, and has been stopped.

7
  • 2
    You can write a batch class to delete all of them in a single go.
    – sunny
    Commented Mar 20, 2017 at 20:28
  • Dataloader.io is also a good option, if you want to delete them via configuration.
    – Raul
    Commented Mar 20, 2017 at 20:31
  • any good examples on doing this? I'm not too familiar with batch jobs.
    – J. Zhang
    Commented Mar 20, 2017 at 20:37
  • Is the problem on export or on delete? Commented Mar 20, 2017 at 20:43
  • 1
    Seen this error more recently (last few weeks). Seems an issue in salesforce. You can no longer get a query locator on millions of records without a filter in a batch start or the query will timeout. So a batch of "Select Id From XYZ_Object" will timeout in a batch start now. Adding a Limit to the query will also timeout. I do not believe it was an issue until recently
    – Eric
    Commented Mar 20, 2017 at 21:36

1 Answer 1

0

As it was already mentioned in the comments section, it might have been a Salesforce issue which is no longer the case. Exporting that amount of data shouldn't throw a timeout.

Nevertheless, if you would like to stick to the Data Loader, consider modifying (increasing) the following values at Settings):

  • batch size (if Bulk API is enabled, the max value is 10000)
  • timeout
  • query request size (the max value is 2000)

But if there is a need to repeat the process, it will be much easier to get familiar with Batch Apex.

Usage example: What is best way to delete all records from any Dev org

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .