Tutorial: Building with CleaveDB
Deleting & Recovering — Overview
In a modern hybrid database, removing records involves more than dropping a row from a table. Documents are connected to other records through graph bonds, indexed in high-dimensional vector spaces for semantic search, and scoped by strict tenant boundaries. CleaveDB provides a tiered data removal and recovery lifecycle that keeps deletion safe, reversible, and graph-aware.
When an application removes a document, CleaveDB coordinates the mutation across all storage subsystems:
- Query Exclusion: Standard
SCOOPandFINDqueries immediately stop returning drained records. - Graph Bond Cascading: Graph relationships attached to drained documents are temporarily deactivated, preventing traversal queries from walking into dead nodes.
- Vector Index Hygiene: Drained documents are masked from neural semantic searches so irrelevant or deleted text does not surface in AI lookups.
The Deletion & Recovery Lifecycle
1. DRAIN (Soft Delete)
Moves identified documents to the rubbish bin. Use for everyday record removal where rollback or audit recovery might be needed.
2. SALVAGE (Restoration)
Pulls soft-deleted documents back from _rubbish into active buckets, re-activating their fields and graph bonds seamlessly.
3. INCINERATE (Hard Delete)
Permanently obliterates documents from disk, Write-Ahead Logs (WAL), and vector stores. Once incinerated, data cannot be recovered.
4. DROP & RESTORE BUCKET
Applies soft-deletion and restoration at the entire collection level, letting you take buckets offline or revive them en masse.
Explore the Deleting & Recovering topics
Each lesson provides practical examples and query syntax for managing document lifecycles:
- Soft delete (DRAIN): safely remove documents and cascade graph relationships to the rubbish bin.
- Restore (SALVAGE): recover soft-deleted documents and re-enable their active bonds.
- Hard delete (INCINERATE): permanently purge records from the storage engine and reclaim disk space.
- Drop & restore buckets: manage bucket-level decommissioning and recovery workflows.
