Unable to delete a vertex in AWS Neptune even after removing all its 50k+ edges
Hi everyone,
I’m running into a strange issue with AWS Neptune and would appreciate any insights.
I’m trying to delete a vertex that used to have over 50,000 edges. Before attempting the deletion, I made sure to remove all the relationships connected to it (using both bothE().drop() and validations to confirm there are no remaining edges).
When I validate the vertex afterward, it shows 0 relationships, but when I try to delete it with something like:
g.V(vertexId).drop().iterate()
the operation just hangs and never completes — almost as if the vertex were still “locked” or referencing something internally.
Has anyone seen this behavior before on Neptune?
Could it be some kind of internal index or cleanup process that prevents deleting large, previously connected vertices?
Any advice or explanation about this behavior would be really helpful.
Thanks in advance!
— Hugo
21 Replies
In what environment are you doing this? For example, are you executing these deletions from graph-notebook? using the aws sdk? something else?
I’m executing this query using gremlin python on a aws Lambda, with query timeout of 300 seconds, all good connection with vpc and aws Neptune, even I know I can delete nodes with less than 10k edges with no problem, but with more edges, colapse the database and get timeout
That sounds a little different than your original question. I hear now you are experiencing timeouts. are those on the deleting of the edges or the single remaining verex?
I’m getting a timeout when trying to delete a single vertex by its ID, even though I supposedly deleted all its edges beforehand.
I also noticed that when deleting the vertex that previously had around 10k relationships, the operation eventually succeeded — but it took a long time, even though I had supposedly deleted all its edges beforehand.
you said that you are using gremlinpython for this. are you using a session to do this? or doing this in a transaction with
g.tx()?I’m using g.tx()
Is the entire transaction designed to just delete one vertex (and its' associated edges)? or is there more happening?
In this particular case, is just one transaction to delete one vertex, not the edges, that happen in another transaction in another lambda, outside the environment and it happen a long time ago before the delete operation of the vertex
oh...hmm, that's interesting
and, in between the deletion of edges that happened a long time ago and deletion request for the vertex you were able to confirm by separate request that the vertex had zero edges?
That’s right, I made a validation before to know it have 0 edges in both_e, in_e, out_e, with limit(1) and count, it always said 0
sorry for trying to get really specific here. just to be clear, this validation of edge deletion was done after the transaction for deleting edges was committed with
g.tx().commit()?That’s right
No problem, I’m really confused with this, cause I don’t understand what is happening, the theory it should be doing that but in reality is something weird
maybe posting the code could troubleshooting?
could something about the vertex other than its edges be affecting it? perhaps 50 000 properties?
Only have 10 properties, and here is the code
sorry I might be sort of blind but I don't see any code which is deleting edges specifically before the node itself?
Sry, here is the other parts
if you add a log in the same transaction before you delete the node to output the number of edges, can you verify that it has zero edges? i am wondering if there's an issue with the transaction boundaries of the transaction deleting the edges vs the one deleting the node
Yep, I did that and have the same value
Is it possible to try performing edge deletion and node deletion in a single transaction?
not sure what options you have open to you, but this might be a case that needs more official support from the Neptune team (i.e. a support ticket).
Got it, thank you for the suggestion! I’ll go ahead and open a support ticket with the Neptune team to look into this further. Really appreciate your help! 🥹