Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apoc.truncate #1337

Closed
eastlondoner opened this issue Nov 8, 2019 · 4 comments
Closed

apoc.truncate #1337

eastlondoner opened this issue Nov 8, 2019 · 4 comments
Assignees
Labels

Comments

@eastlondoner
Copy link

Feature description (Mandatory)

This should wipe a database without causing an OOM. It will therefore need to not be transactional i.e. if it encounters an error during execution it could result in a partially deleted graph rather than a totally deleted graph.

under the hood it should do something like this:

call apoc.periodic.iterate("cypher runtime=slotted match ()-[r]->() return r","delete r", {batchSize:10000,iterateList:true})
call apoc.periodic.iterate("cypher runtime=slotted match (n) return n","delete n", {batchSize:10000,iterateList:true})
@eastlondoner
Copy link
Author

it might make sense to put this in apoc.periodic
i.e. apoc.periodic.truncate
Then it's slightly more obvious that normal transaction rules don't apply

@jexp
Copy link
Member

jexp commented Nov 8, 2019

actually it should just use the java API in parallel transactions. or perhaps kernel api.

db.getAllRelationships().stream().chunk().foreach(Relationship::delete);
db.getAllNodes().parallelStream().chunk().foreach(Node::delete);

But cypher would work too.
Nodes can be deleted in parallel, relationships is a bit more tricky.

to delete clusters concurrently it would be kinda cool to run a clustering algo first,
then delete the clusters innards in separate tx and at the end the boundary nodes and their rels sequentially.

@jexp
Copy link
Member

jexp commented Nov 8, 2019

periodically truncate the database :)

good for chaos monkey

@eastlondoner
Copy link
Author

It would be a bonus if this had a configuration option to drop all indexes.

@conker84 conker84 added the Larus label Jan 26, 2021
vga91 added a commit to vga91/neo4j-apoc-procedures that referenced this issue Mar 4, 2021
fbiville pushed a commit that referenced this issue Mar 29, 2021
conker84 pushed a commit to conker84/neo4j-apoc-procedures that referenced this issue Mar 29, 2021
conker84 pushed a commit that referenced this issue Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants