Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-30-2023 07:02 AM
I was trying to delete all data from the database. And I keep having issues.
First, I was told just to stop the server and delete "/data" but it's not possible on AuraDB, and generally it's the wrong solution for the script I'm writing.
Second, it was suggested to use
"CREATE OR REPLACE DATABASE neo4j;"
But it's not supported on AuraDB
Now Third is the approach using Cypher, I found this query:
MATCH (n)-[r]-()
CALL { WITH r
DELETE r
} IN TRANSACTIONS OF 10000 ROWS
WITH n
CALL { WITH n
DELETE n
} IN TRANSACTIONS OF 10000 ROWS;
And I thought It was working until I got an OutOfMemory error.
dbms.memory.transaction.global_max_size threshold reached
From running "profile" on this query, it turns out that the number of rows in the transaction has no impact on memory usage because the first fetch is eager. To be clear increasing memory is not an option.
I'm completely out of ideas. Any help is greatly appreciated.
01-30-2023 07:41 AM
Hi,
Have you tried the more basic deletion method
Match (n) detach delete n
I think the detach statement is important because it removes the relationships to each node.
Andy
01-30-2023 08:23 AM
On the Aura console - click the overflow menu (the elipsis). There is a menu item that says "reset to blank"
01-30-2023 01:17 PM
Thanks for the suggestion, But unless it's possible via some API call, It's not gonna work for my script.
I need to be able to do this programmatically like "drop database" + "create database" in Postgres.
01-31-2023 08:16 AM
If you think its an overflow issue, maybe delete the information in two phases:
First:
match ()-[n]-()
CALL {
WITH n
DELETE n
} IN TRANSACTIONS OF 10000 ROWS
Second:
match (n)
CALL {
WITH n
DELETE n
} IN TRANSACTIONS OF 10000 ROWS
All the sessions of the conference are now available online