Neo4j.jl
Neo4j.jl copied to clipboard
To commit/rollback after a read transaction?
Hi,
I have a quick question: Do you recommend we commit/rollback after read transactions? We just saw that it's required when performing a write, but not sure whether to add the overhead to all read transactions.
We think this might be related to another trend we had noticed where Neo4j could be holding onto many connections, ultimately resulting in new connections being refused when processing many transactions. One guess is that commit on a read closes out the connection.
E.g.
loadtx = transaction(cloudGraph.neo4j.connection)
query = "match (n) return n";
nodes = loadtx(query; submit=true)
# Is this needed for a read, i.e. is the connection left open?
commit(loadtx)
Hi,
Do you recommend we commit/rollback after read transactions? We just saw that it's required when performing a write, but not sure whether to add the overhead to all read transactions
As you already correctly pointed out, a commit is necessary to close a transaction. The current implementation requires a commit(tx) even though you only send a read transaction.
However, a rollback does not have any effect on a read transaction because it does not alter the state of the DB.
We are currently updating the package so that MATCH-queries are done in a single transaction-commit request. I'm currently testing the implementation and it should be available very soon.
I hope that helps, otherwise, let me know if there is anything else :)
Cheers
This seems like an oversight, thanks for taking care of it @StefanHaunsberger !
@GearsAD has your question been addressed? I'm going to add the "enhancement" label to this issue, once you put up a PR would you mind associating it with the issue @StefanHaunsberger ? Thanks!
Hi,
Yes, thanks! We'll change our pattern to make sure all calls end in commits. Appreciate the help, we're pushing the library pretty hard so this really helps.
@glesica I will
@GearsAD I hope to have the changes up by next week and it should be even a bit faster then as well.
Cheers