Purge Node
purgeNode
is a Cypher procedure available by default in Quine that “hard-deletes” a node, the data that node owns, and the history of data associated with the node from Quine. Data is deleted not only from the materialized graph, but also from the journals and snapshots in the persistor, as well as other auxiliary node managed data stores.
Purpose
purgeNode
may be preferred over soft-deletion (eg DETACH DELETE
) when:
- the node will not be necessary for future queries
- reducing the volume of persistor-managed data is important (eg, given limited disk space)
- historical queries are not in use (as
purgeNode
removes historical records)
Application
As a cypher procedure, purgeNode
can be invoked via typical CALL
syntax: WITH n CALL purgeNode(n) RETURN "success"
, or, minimally, CALL purgeNode(n)
. The argument n
may be any of:
- a node ID (eg, from
id()
oridFrom()
) - a node variable (eg, from
MATCH (n) ...
) - a stringified node ID (eg, from
strId()
or a string literal)
The Cypher query engine will delete the node data including snapshots, journals, and standing query bookkeeping, before the CALL
completes.
Example for deleting a node by id:
CALL purgeNode(idFrom('customer', 'abandoned-cart-1'))
Example for (a slow, all-node scan) query deleting all nodes with a certain label:
MATCH (n:DeleteMe) CALL purgeNode(n)