Deletion of nodes

Hi,

I am trying to delete the nodes that were created mistakenly. But surprisingly, when I am deleting nodes, it is still visible in Graph Schema and Left database info tab too. However, when I am trying to list the elements, using Match(n) return n, it says no elements exists.
I am not sure why deleting nodes doesn't delete it permanently from Database without leaving a trace behind. If there is some other command so as deleted nodes don't exist anymore, please let me know.
I am using this command to delete the nodes :

Match(n:node) detach delete n

Any help would be appreciated. Thanks

Hello @akaur :slight_smile:

If you can still see node labels, it means you have indexes on your database. You can delete them.

For properties, you cannot delete them. You must create a new database to get a clean view.

Regards,
Cobra

2 Likes

Hello Cobra,

That worked. I deleted constraints, after which the nodes became disappear.
Thanks a lot!

Regards,
akaur

1 Like

also your match (n:node) detach delete n; though valid may not work as your database grows. The cypher statement will effectively delete all nodes and all relationships. If you have 1000nodes and each node has 5 relationships then this results in a single transaction deleting 6000 objects. 6000 may not be so large, but if you graph was to be 1million nodes and each node had 10 relationships then that single transaction is more like 11million objects deleted. Such large deletes are not encouraged. See https://neo4j.com/developer/kb/large-delete-transaction-best-practices-in-neo4j/ as a means to batch up such large deletes

1 Like