apoc.periodic.truncateAdmin OnlyProcedure
Syntax |
|
||
Description |
Removes all entities (and optionally indexes and constraints) from the database using the |
||
Input arguments |
Name |
Type |
Description |
|
|
|
|
Config parameters
The procedure supports the same configurations as the apoc.periodic.iterate procedure.
Moreover, it supports the following config parameters:
| Name | Type | Default | Description |
|---|---|---|---|
|
|
true |
drops all indexes and constraints |
Example
Given this dataset:
CREATE (:Person {name: 'Alice'})-[:KNOWS]->(:Person {name: 'Bob'})
CREATE (:Person {name: 'Charlie'})
The following query removes all nodes and relationships from the database:
CALL apoc.periodic.truncate()
MATCH (n)
RETURN count(n)
| count(n) |
|---|
0 |
After execution, the database contains no nodes or relationships, but any existing indexes and constraints are preserved.
To also drop all indexes and constraints in the same call, set dropSchema: true:
CALL apoc.periodic.truncate({dropSchema: true})
Deletion is performed in batches (default size 10000) via apoc.periodic.iterate, making it suitable for large graphs where a single
MATCH (n) DETACH DELETE n would exhaust heap.