Hi everyone,
when I run the following query in Browser:
WITH $hostname AS hostname, $username AS username, $password AS password
CALL apoc.periodic.iterate(
"
CALL apoc.load.jdbc($hostname, \" SELECT \\\"id\\\", \\\"attribute1\\\", \\\"attribute2\\\" FROM service \", [], {credentials:{user:$username, password: $password}}) YIELD row
",
"
WITH row
CALL{
WITH row
MERGE (s:Service {id: toInteger(row.id)})
ON CREATE SET
s.attribute1 = toInteger(row.attribute1),
s:_NEW
ON MATCH SET
s.attribute1 = toInteger(row.attribute1)
}
CALL{
WITH row
MERGE (sl:SLA {id: toInteger(row.id)})
ON CREATE SET
sl.attribute2 = row.attribute2
sl:_NEW
ON MATCH SET
sl.attribute2 = row.attribute2,
}
",
{batchSize:2000, parallel:true, retries: 5, params: {hostname: hostname, username: username, password: password}}
)
YIELD batches, total, timeTaken, committedOperations, failedOperations, failedBatches, retries, errorMessages, batch, operations, wasTerminated, failedParams, updateStatistics
RETURN batches, total, timeTaken, committedOperations, failedOperations, failedBatches, retries, errorMessages, batch, operations, wasTerminated, failedParams, updateStatistics;
I can see that there is a lot of transaction being opened (as mentioned in the docs: apoc.periodic.iterate - APOC Documentation).
When I execute the same query with session.write_transaction
, there is only one transactions running at the same time, so single threaded and no parallelisation.
Did someone get to see/notice this behaviour? If so, is there any way to achieve the same thing as via Browser.
Thanks in advance!