How to delete Neptune graph or delete all vertex and edges from the graph.
Is there also way from the gremlin. Rather than iterating all the nodes and delete single vertex
How to delete Neptune graph or delete all vertex and edges from the graph.
Is there also way from the gremlin. Rather than iterating all the nodes and delete single vertex
Gremlin Code will be g.V().limit(100000).drop().iterate();
Update: g.V().drop().iterate() is sufficient, as drop all queries have now been optimised in Neptune.
Adding another answer as Amazon Neptune now has an API to delete a whole graph efficiently without needing to use Gremlin. See [1] for details.
[1] https://docs.aws.amazon.com/neptune/latest/userguide/manage-console-fast-reset.html
The reset can be done via a curl command or from the Neptune (Jupyter) notebooks.
g.V().drop().iterate()
should be enough. If you are deleting ALL vertices and edges, you don't need to do it in batches or iterate over a fixed number of vertices.
g.V().drop().iterate(); Yes batch is not required ,but you have iterate for the Neptune graph db
AWS Neptune vertex drop is costly when the number of predicates goes up.
what are predicates ?
https://docs.aws.amazon.com/neptune/latest/userguide/feature-overview-data-model.html
Use Explain api by AWS Neptune to know your number of predicates in your graph db. It also shows the warning if number of predicates is high.
Refer this python script to drop without timeout error and faster way to drop vertices.
https://github.com/awslabs/amazon-neptune-tools/blob/master/drop-graph/drop-graph.py