When does transaction's changes reflect in the Graph

transaction

(Michael Weston) #1

Hello,

We have recently discovered the "PERIODIC COMMIT" Cypher statement. To our current understanding, it commits the transaction (and starts another one) every X Cypher statements.
We've also read that the graph is being updated with a transaction's changes when and only when the transaction is committed.

Therefore, when we ran a Cypher query which uses "LOAD CSV" with a periodic-commit of 2000, on a file with 80,000 records, we expected to be able to see the changes on the graph during the query's execution - when in reality, it appeared that the graph has changed only when the whole query has finished executing.
Is this the expected behavior, or have we misused anything?

We think that we might have not quite understand what a 'transaction' is, can you please enlighten us? If we are right thinking that a transaction's changes only reflect in the DB once the transaction is committed, then what is the meaning of a 'rollback'? All it does is just not adding the changes to the DB?

Thank you very much!

Michael


(Andrew Bowman) #2

That is the expected behavior, however certain kinds of queries (usually when you see an Eager or an EagerAggregation in the EXPLAIN query plan) can disable the periodic commit, since the query requested is incompatible with periodic batching (aggregation or DISTINCT or certain Eager operations require working with the entire input set).

Use EXPLAIN on the query to see the query plan, and look out for those dark-blue DISTINCT, Eager, or EagerAggregation operations, if any of those are present that would explain the observed behavior. You may have to alter your query to avoid these operations to allow periodic batching. If you can share your query, we may be able to help.