cancel
Showing results for 
Search instead for 
Did you mean: 

Best Practice for Replacement of USING PERIODIC COMMIT to CALL {} IN TRANSACTIONS

omerule
Graph Buddy

Good morning,
After upgrading to version 4.4 And running some Import scripts I get new errors about ' to many current transactions'. or 'not enough memory '. This happens with importing CSV files creating merging update etc. I made the import steps small with PERIODIC COMMIT. But now it seems that PERIODIC COMMIT is Deprecated and use CALL {subquery} IN TRANSACTIONS instead. I have been able to ' transform' some of the import steps from PERIODIC COMMIT to CALL {} IN TRANSACTIONS. But I got stuck with Importing a CSV file which does something like
LOAD CSV FROM "person2computer" AS csv
CALL { WITH csv
MATCH (a:Person WHERE a.name = csv.name), (b:Computer WHERE b.computername = csv.computername)
MERGE (a)-[r:OWNS]->(b) SET r.since = csv.year etc...
} IN TRANSACTIONS
The error i now get = ' can only start inner transactions in an implicit transaction'.

What is the best practice when you want to use CALL {} IN TRANSACTIONS as a replacement for USING PERIODIC COMMIT. And what is causing the last error message?

Yours Kindly
Omer

1 ACCEPTED SOLUTION

abk
Neo4j
Neo4j

Hi @omerule ,

When running with Neo4j Browser, prepend the query with :auto to instruct Browser so submit the query as an implicit (also known as auto-commit) transaction.

For example:

:auto LOAD CSV WITH HEADERS from "example.csv" AS line
CALL {
    with line
    CREATE (n:Example)
    SET n = line
} IN TRANSACTIONS OF 10 ROWS

You can read more about explicit vs implicit transactions here Transactions - Neo4j Cypher Manual

Best,
ABK

View solution in original post

2 REPLIES 2

abk
Neo4j
Neo4j

Hi @omerule ,

When running with Neo4j Browser, prepend the query with :auto to instruct Browser so submit the query as an implicit (also known as auto-commit) transaction.

For example:

:auto LOAD CSV WITH HEADERS from "example.csv" AS line
CALL {
    with line
    CREATE (n:Example)
    SET n = line
} IN TRANSACTIONS OF 10 ROWS

You can read more about explicit vs implicit transactions here Transactions - Neo4j Cypher Manual

Best,
ABK

I notice the :auto is some videos Thank for explaining this and I will read the manual about Transactions, and try the translate this to the current PERIODIC COMMIT issues I have.

Yours Kindly Omer.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.