The included APOC library of functions provides a mechanism to process batch jobs using the apoc.periodic.iterate() function. Using this function can allow for long-running batch processes to complete when on their own they might suffer from timeouts or other exceptions.
There are some important parameters to use when running the function on Aura:
- batchSize: limits how many queries are run within a given transaction. Setting this too high can result in out-of-memory errors. Setting it too low can result in the function running longer than needed. We generally recommend using batches of 100, 500, or 1000, depending on the operation. If you start with a large number and still see OOMs, first try those lower values.
- retries: sets how many retries to attempt if there is a failure. Each retry is attempted after a 100ms sleep. It's possible that a long-running query can encounter connection errors due to transient changes in the Aura database from patching, maintenance, or other operations. These changes typically last only a few milliseconds so setting at least "retries: 1" will solve the majority of these problems. If you're seeing continued failures try using "retries: 3".
If those extra parameters still do not resolve the issue, you can connect with our Support Engineers using the Open Ticket button at the bottom of this page.