Hot answers tagged

6

For my SObjectWorkQueue I am using batch chaining and serialized work records. It’s not a new approach but worked very reliably in the past for me. Not sure if I ever saw this penalty. https://github.com/rsoesemann/sobject-work-Queue  


3

It seems to me this is very like your previous question, and likely has the same basic answer... The issue I see in your first batch is that the aggregate query does not limit the query for "maplastY" to those entries relevant to the bible instances in the scope. That means every call to execute will try to aggregate query over all 900000 telephone records ...


3

Personally, I have not seen Batches to be queued that long, even if they are it doesn't seem SF will kill them after some time if they are in limit. That being said, You can follow another approach. We know at max 5 batch jobs can run at a time. Let's utilize this and start the next batch at the end of each batch. RandomBatch bch = new RandomBatch(0); ...


3

Lucky for you, Salesforce changed the way query aggregation counts against your limits recently, so you can drop the child query altogether. Just use aggregate queries instead. Before, every record which went into the aggregation counted against you, but now only every aggregation counts. public with sharing class MyRollupBatch implements Database.Batchable&...


3

Yes, you have a high likelihood - more like a certainty, really - of hitting a variety of limits in this scenario. We need to iterate through obj1, get its relevant records from obj2 based on Id and further query for permission of each object in the user permission table and make [multiple] external call outs for them. Obj1 has around 5 M records and each ...


2

I would recommend you to use Batch but without querying sub-records, this could lead to unpredictable errors, especially if you have 200+ of them. Try to rewrite your query in the next way: public Database.QueryLocator start(Database.BatchableContext context) { return Database.getQueryLocator([ SELECT Id FROM Child__c WHERE Parent__c IN :(SELECT Id ...


2

If you are in a batch asynchronous context when parsing the CSV files then you total heap size of 12 MB applies. That should be more than enough to load in the approximately 2.5 MB of raw CSV data and then process it. You would be looking at about 5 MB of Heap usage all up, not including the Account and Address records you wanted to process. You mentioned ...


1

you are mixing here the concept of start and execute methods of Database.Batchable<sObject> interface. in start, you are writing a query, that defines what records should be processed in execute method. Just a filter for records that should be selected. In order to set size of records passed to execute method as a scope, use Database.executeBatch(...


1

Remove static from the method signature. It will work as expected. Go through batch apex document: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm


1

You can call batch from the previous batch finish() method. For example, Initial step to call in developer console or anonymous is Database.executeBatch(new RecursiveBatch(Date.valueOf('2019-01-01'))); Then you can use this stub. public class RecursiveBatch implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful { private ...


Only top voted, non community-wiki answers of a minimum length are eligible