Lompat ke konten

Pelajaran 21 ยท Lifecycle and Maturity

Data Retention and Disposal

Build a retention schedule with triggers and periods, apply legal holds, archive correctly, delete safely across backups and copies, and keep proof of disposal.

Keeping everything forever feels safe. It is not. Old data costs money, slows systems, confuses analysts and widens the impact of any breach. Deleting too early can break legal duties or lose evidence. Retention is the decision about how long to keep each kind of data, and disposal is what happens when that time ends.

The retention schedule

A retention schedule lists record types with how long to keep them, from which event, and what happens next.

Record type Trigger Keep for Then
Customer account Account closed 2 years Delete or anonymize
Invoices End of fiscal year 7 years Delete
Unsuccessful job applications Decision date 6 months Delete
Web server logs Created 90 days Delete
Signed contracts Contract ends 6 years Review

These periods are invented examples. Real periods depend on your laws, sector, contracts and business needs. Legal and records specialists must set them.

For each row also record the reason (law, contract or business need), the owner and where copies exist.

Triggers matter

"Keep for 7 years" is meaningless without a start event. Common triggers are creation date, last activity, contract end, account closure or case closure. Your systems must record the trigger date, or you cannot apply the rule.

A legal hold suspends normal deletion for data that may be relevant to a dispute, investigation or audit. It overrides the schedule until formally released. Your deletion process must check holds before removing anything, and releasing a hold should be recorded.

Calculate what is due

SQL Find records due for disposal, respecting legal holds (SQL)

Press Run (or Ctrl + Enter) to see the result here.

This query only lists candidates. A production job should run in a reviewed process, with a dry run first, and log what it did.

Archive or delete?

Archiving moves data to separate, usually cheaper storage while keeping it available for a legitimate reason. It should have restricted access, a known format you can still read in years, and its own disposal date. Moving data to an archive does not end its life; it only changes where it waits.

Deletion is harder than it sounds

Data lives in more places than you expect: the main database, replicas, caches, search indexes, data warehouse, files, logs, exports, emails and backups, plus service providers. Use your inventory and lineage to find copies. Options include:

  • Delete the records.
  • Anonymize them, if the result truly cannot identify people.
  • Crypto-shredding: destroy the encryption key for data encrypted separately, so it can no longer be read.
  • Physical destruction for retired media, with a certificate from a trusted provider.

A soft delete only marks a record as deleted. It still exists and can still leak. If rules require removal, finish the job.

Backups are a special case. You often cannot edit one record inside a backup. Common approaches are letting backups expire on a short cycle and re-applying deletions after any restore. Document your approach and have advisers confirm it is acceptable.

Plan deletion with a map

Python Build a deletion plan across systems

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Proof of disposal

Keep evidence that disposal happened: what was disposed of (by category, not copies of the data), when, by which method, and who approved it. The log itself must not preserve the sensitive values you just removed.

Never run a bulk deletion without a dry run, a hold check and a tested way to recover from a mistake. A wrong retention query can destroy years of records.

A worked example: setting up one rule

A fictional gym wants to remove data about people who tried a free class and never joined. The team works through it:

  1. Record type: trial visitor.
  2. Trigger: date of the last visit or contact.
  3. Period: proposed by the business, confirmed by advisers.
  4. Exceptions: an open complaint or injury report, which places a hold.
  5. Locations: booking system, email list, paper sign-in sheets and the analytics copy.
  6. Action: delete personal details; keep only counts that cannot identify anyone.
  7. Proof: a monthly log with the number of records removed in each system.

It is easy to forget the paper sheets, yet they hold the same information.

Running disposal safely

Start with a dry run that lists what would be removed and have the owner check a sample. Set limits so a job stops if it would delete far more than usual. Run deletions in batches, record results and handle failures visibly, because a half-finished job leaves systems inconsistent. Check how related records are handled: removing a customer must not break the link to invoices you are required to keep, and it must not delete them by accident through a cascade.

Review the schedule

Review the schedule regularly and whenever laws, contracts, systems or business processes change. Add a retention row before a new system starts collecting a new kind of record. Check that automated disposal jobs still run and still match the approved rows. A schedule that is approved but never executed gives a false sense of control, and it may contradict what your privacy notice tells people.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. What does a legal hold do?

    A hold overrides the schedule until it is formally released.
  2. 2. Why is a soft delete not the same as deletion?

    Marking a row hides it from some screens but keeps the data.
  3. 3. What must a retention rule state besides how long to keep data?

    Without a trigger, you cannot calculate when the period ends.

Summary

  • A retention schedule gives record types, triggers, periods, actions, reasons and owners.
  • Legal holds override deletion until released.
  • Archives need access control and an end date too.
  • Deletion must cover copies, providers and backups with a documented approach.
  • Dry-run, verify and keep safe evidence.

Next: Data Management Maturity

Progres Anda disimpan di browser ini. Tidak perlu akun.