Hi,
I’ve a process that batch deletes a few thousand records, which needs to be broken up to prevent the database locking up.
To do this, I’m just selecting the first 100 records, deleting them, and starting a new process which performs the same function:
def perform() do
if_any_records_to_delete?() {
logic_to_delete_first_100_records()
Task.Supervisor.async_nolink(
MyApp.BatchDeleter.Supervisor,
fn -> perform() end
)
}
end
Will this setup close the connection to the DB and allow other queries to execute in-between runs, or will it maintain the same connection until all the records in question are deleted?
Thanks,
Mark