Skip to main content
OnDB uses an append-only storage model. Data is never overwritten or physically removed — every change is recorded as a new entry. Optional immutability via a Data Availability layer is available for use cases requiring on-chain verification.

How It Works

OperationBehavior
CreateAppends a new record with a unique ID and timestamp
ReadReturns the latest version of a record by default (based on timestamp)
UpdateAppends a NEW record with the same ID but a newer timestamp. The original record remains unchanged.
DeleteAppends a record with deleted: true (soft delete). Previous versions are preserved.

Traditional DB vs OnDB

AspectTraditional DBOnDB
UpdateModifies existing row in placeAppends new version, old version preserved
DeleteRemoves row from storageSoft delete, data is preserved
HistoryLost unless manually trackedAutomatic, all versions preserved
Audit trailRequires additional implementationBuilt-in, cryptographically verified
StorageFixed per recordGrows with each version

Benefits

  • Complete audit trail — All historical versions are preserved and can be queried
  • Tamper-proof history — Past states cannot be altered or deleted
  • Cryptographic verifiability — When on-chain mode is enabled, every change is recorded with a block height and transaction hash
  • Conflict-free — No race conditions on writes since each version is a distinct record

Implications

  • Storage grows with each update (each version is a new record)
  • Historical versions can be queried by timestamp if needed
  • Data is never physically removed from the blockchain
  • “Deletes” are logical — they mark records as deleted but prior versions persist

Data Retention

While the underlying storage is immutable, OnDB supports configurable retention policies per collection to manage storage costs.
SettingDescriptionCost
PermanentData stored indefinitely, no automatic cleanupStandard storage fees
30 days or lessFree tier — no additional retention costsFree
31+ daysExtended retention with monthly cost per KBVariable
The first 30 days of retention are free for all collections. Costs only apply for retention periods beyond 30 days.

Configuring Retention

From the Dashboard:
  1. Navigate to your application
  2. Select the Retention tab
  3. Expand a collection to view/edit its settings
  4. Enter the retention period in days (leave empty for permanent)
  5. Click Save to apply changes
Data TypeRecommended Retention
Session data7-14 days
User activity logs30-90 days
Analytics events30-180 days
Transaction recordsPermanent
User profilesPermanent
Audit logsPermanent or compliance-required period
Once data is cleaned up by the retention policy, it cannot be recovered. Ensure you have appropriate backups for critical data before setting retention limits.

Next Steps