Skip to content

Instantly share code, notes, and snippets.

@maxdemarzi
Created July 28, 2015 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxdemarzi/bf4547ef108914cd82f6 to your computer and use it in GitHub Desktop.
Save maxdemarzi/bf4547ef108914cd82f6 to your computer and use it in GitHub Desktop.
int i = 0;
Transaction tx = db.beginTx();
try {
for ( Relationship relationship : GlobalGraphOperations.at(db).getAllRelationships()) {
// Do some work on relationship property
i++;
// Commit every x transactions
if (i % 10000 == 0) {
tx.success();
tx.close();
tx = db.beginTx();
}
}
tx.success();
} finally {
tx.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment