I am setting up indexes for my nodes and properties in Memgraph looking at the documentation on indexes. I have two questions regarding the index management that I hope someone could help clarify:
Is it necessary to create the index only once or is there a need to recreate it under certain circumstances?
When executing the command MATCH (n) DETACH DELETE (n)
, which deletes all nodes and relationships, does this action also result in the deletion of the indexes, or are they preserved?
It is enough to create indexes only once. You can use the SHOW INDEX INFO;
query to check the existing indexes. If you are using Memgraph Lab, the information can be seen in the top bar.
Executing the Match (n) detach delete (n)
query will not drop any indexes. The indexes remain intact even after deleting all nodes and relationships. To explicitly drop indexes you should use the DROP INDEX
query.