Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

Data Retention and Deletion Engineering: Schedules, Backups and Proofs

Data retention works only when every store that holds a record class has a written period, a deletion method and a proof, and backups either age out, lose their keys or re-apply deletions after a restore. Netbase designs it in that order: inventory the stores, encode the schedule, pick a method per store, then prove each run.

Book a solution review See the healthcare operations solution

By Netbase Delivery and Quality Desk · Reviewed by David (CEO) · Updated · 11 min read

star

This guide is for CTOs, tech leads and compliance owners who have a retention policy, or a privacy request, and need the engineering behind it. It belongs to Netbase's application security assurance work, next to the guides on audit logging design and application key management. It is engineering guidance, not legal advice.

In this guide

Why does deleting a row not delete the data?

A row deleted from the primary database usually survives elsewhere: in replicas, caches, search indexes, object storage, event and application logs, the warehouse and every backup taken before the delete. Many stores also delete lazily. In PostgreSQL a deleted row stays on disk as a dead tuple until vacuum reclaims the space, as the PostgreSQL routine vacuuming documentation explains.

Regulators expect the whole picture. The UK regulator's storage limitation guidance asks organisations to set and document standard retention periods for categories of information and to erase or anonymise personal data at the end of each period unless there is a clear reason to keep it.

What should a retention schedule the code can read contain?

A retention schedule becomes enforceable when it is data, not prose. Keep it in the repository next to the code, one row per record class, and let the deletion jobs read it. Each row carries six fields:

  • Record class: for example customer account, order, support ticket, uploaded document, audit event.
  • Trigger event: what starts the clock, such as account closure, last order, ticket resolution or creation date.
  • Retention period: the period from the obligation that sets it, with the obligation named in a comment.
  • Legal hold flag: whether a dispute or investigation can pause deletion, and who may set or lift the hold.
  • Deletion method: hard delete, anonymise, crypto-shred or expire by lifecycle rule.
  • Owner: the person who answers for the row when a contract, product or law changes.

When two obligations conflict, the longer one sets the period, and the personal data inside is reduced instead: keep the invoice, drop the free-text fields. Review it whenever a new store or contract appears.

Which deletion method fits which store?

Each store forgets differently, with its own delay and its own proof. Map them before you promise anyone a deletion date.

Store Deletion method Delay before the copy is gone Proof it can give
Primary database and replicas Hard delete or anonymise by subject key, cascading to child tables Replicas follow within their lag; disk space waits for vacuum or compaction Row counts by subject key return zero after the job
Caches and search indexes Explicit eviction and re-index on the delete event; short time-to-live as a backstop Until eviction or the time-to-live ends Lookup by key returns nothing after eviction
Object storage and uploaded files Delete by object key; lifecycle expiration rules for whole prefixes Lifecycle rules run asynchronously after the expiry date Inventory report or listing without the key
Queues, event logs and application logs Compaction with tombstones, short log retention, or per-subject encryption keys Until compaction or the log retention window passes Retention settings plus a key-destruction record
Analytics warehouse Delete or pseudonymize through raw, modelled and reporting tables Until the next scheduled run of each model Query by pseudonym returns zero rows
Backups Age out, crypto-shred or restore and re-apply (see below) Until the last backup that holds the data expires Backup catalogue showing expiry, or key destruction
Third-party processors Deletion request through their API or contract process As the processor's terms state Their confirmation, stored with the request

Lifecycle rules are scheduled, not instant: the Amazon S3 lifecycle documentation describes expiration actions that queue expired objects for removal, which is not always immediate. Logs that cannot be rewritten should never hold plain personal data. The warehouse leg is covered in the guide to privacy-aware analytics.

How should backups handle deleted data?

Backups need a written answer before the first deletion request. Three rules work, and each is wrong somewhere:

  • Age out. Keep backups only as long as recovery needs, so deleted data disappears when the last backup holding it expires. Wrong when backups are kept for years for other reasons.
  • Crypto-shred. Encrypt personal data under per-subject or per-tenant keys and destroy the key on deletion; the backup still holds ciphertext nobody can read. Wrong when the team cannot run a key service reliably, because a lost key is also a lost customer record.
  • Restore and re-apply. Accept that backups hold deleted data, keep a log of deletions, and re-run every deletion after any restore before the system goes live. Wrong when restores are frequent and the deletion log is not tested.

The UK regulator's right to erasure guidance accepts that backup data may not be overwritten at once, provided it is put beyond use and not used for any other purpose. Whatever rule you choose, test it in the same exercise as your backup restore tests: a restore that brings deleted customers back to life is a failed restore.

What does a deletion proof record look like?

A deletion proof shows that a deletion ran in every store without keeping the data it removed. Record, for each request or scheduled run: a request ID, a one-way reference to the subject that cannot be reversed on its own, the record classes and stores covered, the method used per store, the time each step finished, the result of the verification query, and any store that was skipped with the reason (legal hold, processor pending).

Write the proof as an audit event so it inherits the audit log's protection. Never store the deleted email address or name in it, or the proof becomes a new copy of the data.

How do you build deletion across stores, step by step?

  1. Inventory the stores

    List every store, backup set and processor that receives personal or regulated data.

  2. Assign record classes

    Map each store to the record classes it holds and to the subject key that finds them.

  3. Encode the schedule

    Put the retention schedule in the repository and have jobs read it, with legal holds as data.

  4. Choose a method per store

    Use the table above and note each store's delay.

  5. Decide the backup rule

    Pick age out, crypto-shred or restore and re-apply, and add it to the restore runbook.

  6. Build one orchestrator

    One job fans out to every store, retries failures and is safe to run twice.

  7. Verify and record

    Run a verification query per store after each step and write the deletion proof as an audit event.

  8. Rehearse

    Delete a test subject end to end, including a restore, and review the result.

Where AI fits

AI helps find the data, never decides what to delete. A model can scan schemas, code and log samples to propose which fields hold personal data and which stores were missed in the inventory and summarise deletion proof records for review. Engineers decide every period and method, run the deletion jobs and check every proposal against the actual stores, and no AI tool receives secrets or unredacted personal data. Netbase works with the major commercial and open-source AI tools and models, chosen per project, under human control.

What delivery record exists, and what does not

Netbase's published security practices include secure code review and version control, TLS in transit and AES at rest, role-based access control, MFA for admin dashboards, vulnerability scanning and penetration testing, disaster recovery, and NDAs, DPAs and SLAs on request. Security by design is part of how Netbase approaches delivery, and Netbase follows GDPR alignment for data privacy in Europe, HIPAA-aligned methodologies for healthcare data handling and CCPA compliance for clients with U.S. customer bases.

Netbase has delivered projects for clients in healthcare and other industries, including a healthcare operations platform for a client that is not named. Netbase also works as offshore development partner on a multi-tenant cloud ERP for a US client delivered as SaaS to small and mid-sized businesses, where a departing tenant must be deleted from every store.

Netbase holds ISO 27001 certification and a SOC 2 Type II attestation for its own operations; neither certifies a client's application or its deletion process. Delivery follows a six-step lifecycle with weekly reviews, where an open store in the inventory is tracked like any other item. Netbase does not publish deletion volumes, retention periods from client projects or a timeline for a deletion project; this guide explains a method, not a case study.

Who should build deletion, and how do you choose?

Three routes are common; the choice depends on how many stores you have:

  • Your own team, store by store. Fits one application with few stores and an owner who knows them all.
  • A privacy or data governance platform. Fits many systems and many processors, where discovery and request tracking matter more than code. You still need engineers for your own databases and backups.
  • An engineering partner for the build. Fits a custom application with several stores, a backup question and a deadline. Choose a partner that writes the inventory, the schedule, the orchestrator and the rehearsal, and hands all of it to your team.

When is per-subject encryption not worth it?

Crypto-shredding and a deletion orchestrator add a key service, rotation, monitoring and new failure modes. Skip per-subject keys when backups already expire quickly and logs hold no personal data; a schedule plus short retention is enough. Skip a separate orchestrator when one database and one bucket hold everything; a tested job and a proof record do the work.

Limits of this guide

  • It does not tell you which retention periods apply to you; that depends on your contracts, sector and jurisdictions, and needs legal review.
  • It does not cover physical media disposal; the NIST media sanitization guidelines address that.

Plan the next step with a Netbase consultant

Frequently asked questions

Not always at once. The usual accepted approach is to put the backup data beyond use, let it expire on a short schedule or destroy its encryption key, and re-apply the deletion if a backup is ever restored. Write down which rule you use before the first request arrives.

As long as the longest obligation that applies to that record class, such as tax, contract or sector rules, and no longer. Encode that period in a retention schedule with a named owner, and reduce the personal data inside records you must keep.

A record per request or run that lists every store, the method used, when each step finished and a verification query result, without storing the deleted data itself. Keep it as an audit event so it is protected like the rest of your evidence.

Next step

If a customer asked tomorrow for proof that their data is gone from every system, and nobody could answer, send us a short description of your application and we will reply with a proposal for a store inventory and deletion design review.

Application security assurance for web, SaaS and AI features Application security assurance for web, SaaS and AI features

Netbase provides application security testing for product and engineering leaders to find and fix vulnerabilities before release, including in AI features. We review code with AI-assisted triage, scan dependencies and test running applications, then rank findings and retest fixes. Netbase's own alignment with ISO 27001 and SOC 2 Type II covers Netbase's operations, never your application.

Learn More
line
Healthcare operations platform with AI: scheduling, patient flow and records workflows Healthcare operations platform with AI: scheduling, patient flow and records workflows

A healthcare operations platform is software for the operational side of clinics and hospitals: scheduling, patient flow from check-in to discharge, staff tasks and records paperwork, with AI drafting intake data and scheduling advice for staff to approve. Netbase builds it custom, reviews data handling per jurisdiction with your advisers, gives no compliance guarantee, and has delivered healthcare operations work.

Learn More
line

Work with Netbase remotely

Every Netbase engagement is delivered remotely, so clients in any country and any industry can work with us; Netbase has worked with clients in 80 countries. Contracts and invoices are issued by Netbase JSC, and payment is made by bank transfer to Netbase JSC's company account or PayPal Business. Talk to the CEO, Huy Nguyen (David), on WhatsApp or by email.

Contact Netbase

Discuss a project

Netbase JSC helps organizations design, build, modernize, and operate digital products and AI-enabled business systems.
Project enquiries

project@netbasejsc.com

WhatsApp

+84 937 869 689

Office address

91 Nguyen Chi Thanh, Dong Da, Hanoi, Vietnam

Get in touch

Tell us what you want to build, modernize, or operate.

Tell us what you want to build, modernize, or operate.

Contact Netbase