cancel
Showing results for 
Search instead for 
Did you mean: 

DETACH DELETE n doesn't wipe out everything in the brower

lingvisa
Graph Fellow
MATCH (n)
DETACH DELETE n

This removes all labels and relationships in the graph. But in the browser, label and property names are still there. It doesn't hurt too much. Is there a way to get rid of any trace in the old graph? I usually remove and re-create the database files from the data/databases directory.

Just curious.

3 REPLIES 3

alexandra
Node Link

Hi @lingvisa,

Apart from deleting nodes and relationships you need to delete all indexes and constrains you created on top of those. The easiest way is by using the apoc library

CALL apoc.schema.assert({},{},true) YIELD label, key
RETURN *

Yes. The labels are wiped out by the command, but properties still stay there.

Cobra
Ninja
Ninja

Hello @lingvisa

I advice you to also use APOC to delete nodes and relationships:

CALL apoc.periodic.iterate('MATCH (n) RETURN n', 'DETACH DELETE n', {batchSize: 1000})

@alexandra gave you the right way to delete indexes.

But you cannot delete properties. The only way right now is to create a new database

Regards,
Cobra

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.