← Lessons

quiz vs the machine

Gold1350

System Design

Retention Policies

Deciding how long each resolution of data is kept before deletion.

4 min read · core · beat Gold to climb

Data does not live forever

A retention policy defines how long samples of a given resolution are kept before they are deleted. Without one, a metrics store grows without bound.

Tiering retention by resolution

Retention usually pairs with downsampling tiers:

  • Raw high resolution data kept for days or weeks.
  • Medium rollups kept for months.
  • Coarse rollups kept for years.

This keeps recent debugging detail while letting long term trends survive cheaply.

How deletion happens

  • Time series stores write data in time chunked blocks.
  • A block past its retention is dropped whole, which is far cheaper than deleting individual points.
  • Compaction merges and ages blocks toward coarser tiers.

Choosing a policy

Balance cost, compliance, and usefulness. Ask how far back anyone actually queries at full detail, and set raw retention just past that.

Key idea

Retention sets a lifetime per resolution and is enforced cheaply by dropping whole time blocks, with coarser tiers kept longer than fine ones.

Check yourself

Answer to earn rating on the learn ladder.

1. Why are whole blocks dropped instead of individual points?

2. How does retention typically relate to resolution?