data-infra
Glossary ↗Data Retention Policy
A data retention policy is a defined, typically automated ruleset specifying how long different categories of data are kept before being archived to cheaper storage or permanently deleted, rather than accumulating indefinitely by default. Why it matters for AI/SaaS builders: retention policy sits at the intersection of cost control, compliance, and product trust — unbounded data growth quietly inflates storage and (for anything indexed, like vector embeddings) query cost over time; regulations like GDPR grant users a legal right to have their personal data deleted on request, which a product must be technically capable of honoring, not just promise to honor; and AI-specific data categories — raw LLM prompts/completions containing potentially sensitive user input, uploaded documents fed into RAG pipelines, generated images/audio — often carry retention obligations or user expectations that differ meaningfully from a company's regular application logs. Designing retention policy after the fact, once years of unstructured data have accumulated across a dozen systems with no clear ownership, is a substantially harder problem than designing it in from the start. How it works: retention rules are typically implemented via a combination of object storage lifecycle policies (auto-delete or auto-tier objects older than N days — the mechanism covered under Object Storage/S3), scheduled database jobs that purge or archive old rows past a defined TTL, and — critically for compliance — a defined process for cascading a deletion request across every system holding a copy of a user's data, including derived data like vector embeddings generated from their documents, cached LLM responses containing their input, and any backups. A common and important nuance: "delete the user's row" is not the same as "delete the user's data" in a system with vector search, caching, and backups all potentially holding independent copies or derivatives of the original content — a genuinely GDPR-compliant deletion flow has to account for all of them, not just the primary database record. Worked example: an AI SaaS defines a retention policy where raw uploaded documents are deleted from object storage 30 days after a subscription is cancelled, generated AI outputs are retained for 1 year for customer reference, and — critically — a "delete my account" request triggers a cascading job that removes the user's row, their documents from S3, their embeddings from the vector store's namespace, and purges any cached LLM responses keyed to their content, with the whole cascade logged for compliance audit purposes rather than relying on a single `DELETE` statement that only touches the primary database table.
Related terms