Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-13-2020 07:09 AM
I don't know what the correct way to start an empty db. I know that I can remove all nodes and relations by doing
match (n)
with n limit 10000
DETACH DELETE n;
over and over again until everything is gone, but this is not reasonable to do on a huge database.
Is there not a simpler way to remove everything?
06-13-2020 07:14 AM
Hello @Rogie
With apoc:
CALL apoc.periodic.iterate('MATCH (n) RETURN n', 'DETACH DELETE n', {batchSize:1000, iterateList:true})
Regards,
Cobra
06-13-2020 08:14 AM
Trying this now, but it seems extremely slow. Has been running for an hour and still not complete.
06-13-2020 08:18 AM
How many nodes and relationships do you have?
Did you put index on them?
06-13-2020 08:24 AM
Around 10 million nodes. Each type has a uniqueness constraint for some attribute.
06-25-2020 05:34 AM
Why not simply create a new database?
Anyway, if you insist on deleting the objects don't forget to erase the indexes and constraints (schema). Just look up the command I don't remember the syntax.
06-13-2020 08:28 AM
Do you have enough RAM and a good processor?
The request I gave you is the fastest one to delete everything in the database
Regards,
Cobra
06-13-2020 08:29 AM
How long should I expect it to take? There are 8GiB of ram on the system.
06-13-2020 08:44 AM
To be honest I don't know, 8Go looks small for a database with 10 millions nodes
You just need to wait
06-13-2020 08:59 AM
How much RAM do you suggest to have in this case?
06-24-2020 10:53 AM
Hi @Rogie,
If you are using Neo4j 4.x you can switch to the system database using :use system
and then run drop database <database_name>
Then to create a new empty database run create database <database_name>
.
04-14-2021 05:14 PM
To be clear, this solution only works for Enterprise Edition.
All the sessions of the conference are now available online