I am mostly familiar with MySQL, if I wanted to truncate a table I would normally issue the command
TRUNCATE <table>
And to drop
DROP <table>
Now, on neo4j -- what would be the best way to do this?
I am mostly familiar with MySQL, if I wanted to truncate a table I would normally issue the command
TRUNCATE <table>
And to drop
DROP <table>
Now, on neo4j -- what would be the best way to do this?
The closest equivalent is
MATCH (n)
DETACH DELETE n
The DETACH
keyword causes relationships of the nodes to be deleted as well.
This doesn't work well on large graphs (~10M nodes+, depending on your RAM), because the transaction state is held in memory. But you can work around that by repeating following command, which deletes 1M nodes at a time:
MATCH (n)
DETACH DELETE n
LIMIT 1000000