Retention and deletion are defined

For each kind of data it owns, the service says how long it is kept and how it is removed.

MediumChecked by hand

Applies to:
Services that own a data store
Rule id:
data.retention-defined

Why it matters

Data kept forever by default costs more every year, slows every query and backup, and widens what a breach exposes. For personal data, keeping it longer than needed is against the law in many places. Deciding retention late means deleting from tables that were never designed for it.

How to apply it

  • For each store or table group, state the retention period and the reason: legal, contractual, operational.
  • Implement removal as a scheduled job or a store feature (TTL, partition drop), not a manual task.
  • Cover the copies: backups, caches, search indexes, logs and the copies other services built from your events.
  • Publish an event when data is erased, so those copies can follow.
  • Prefer anonymizing to deleting where totals must stay correct.

Example

"Orders are kept seven years for tax reasons, then anonymized by a monthly job. Carts are deleted after 30 days of inactivity by a TTL index. Erasing a customer publishes CustomerErased; backups expire after 35 days."

References

Checklists with this rule

Related agent skill: database-per-service