Note: See Chapter 12, Importing Data from CSV on how to import data from CSV files.
Updating very large amounts of data (e.g. when importing) with a single Cypher query may fail due to memory constraints.
For these situations only, Cypher provides the global USING PERIODIC COMMIT query hint for updating queries.
Periodic Commit tracks the number of updates performed by a query (creating a node, setting a property etc.). Whenever the number of updates reaches a limit, the current transaction is committed and replaced with a newly opened transaction.
Using periodic commit will prevent running out of memory when updating large amounts of data. However it will also break transactional isolation thus it should only be used where needed.
PERIODIC COMMIT with no specified number of entity updates, using 1000 as the default value.
Query.
USING PERIODIC COMMIT
FOREACH (id IN range(0, 10000)| CREATE (n:User { id: id }))
PERIODIC COMMIT with a specified number of entity updates after which the transaction should be committed.
Query.
USING PERIODIC COMMIT 500
FOREACH (id IN range(0, 10000)| CREATE (n:User { id: id }))
Copyright © 2014 Neo Technology