Data Storage · Study deck

Data Retention and Downsampling

Picture a cold store that keeps one temperature reading each minute.

Data Dora is your guide for this deck.

timeseriesretention
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Design a retention contract that separates raw telemetry, rollups, archives, deletion, and legal holds.
  • Choose downsampling fields that preserve enough evidence for dashboards and investigations.
  • Run a retention dry run before deleting raw data.
  • Explain how late arrivals and rollup refresh windows affect retention safety.
iotclass.org

Major section

Start With the Deletion Request

Telemetry means readings and status sent from equipment for remote use.

  • The storage owner wants to remove old raw data, while the duty team may still need to explain a short heat spike from last month.
  • This opening does not set one lifetime for every reading.
  • Practitioner designs the raw, summary, archive, hold, and approval route.

Key terms

Downsampling
Downsampling is safe only when that evidence survives.
iotclass.org

Major section

Start With the Deletion Request (continued)

Under the Hood examines late arrivals, partition removal, refresh windows, platform commands, and the proof needed before detail is gone.

  • Retention becomes serious the first time someone asks to delete raw readings.
  • Downsampling is safe only when that evidence survives.
  • “Every reading has a time and a cost — decide retention before you decide the database.”.
Retention should be visible as a lifecycle with raw windows, rollups, archive proof, deletion approval, and hold exceptions.
Retention should be visible as a lifecycle with raw windows, rollups, archive proof, deletion approval, and hold exceptions.
iotclass.org

Major section

Retention Dry Run

The hold gate then checks investigations, disputes, compliance rules, and warranty cases that still need raw detail.

  • A dry run should run before the first automated deletion and before any policy change that shortens raw retention.
  • It should report the raw partitions that would be affected, the rollups that replace them, archive status, restore status, query replay results, hold exceptions, and approval owner.
  • Cost: a restored sample partition must match the expected query result before deletion is approved.
A retention dry run proves replacement evidence before deletion becomes automatic.
A retention dry run proves replacement evidence before deletion becomes automatic.
iotclass.org

Major section

Platform Patterns

Retention is implemented differently across systems.

  • The review habit should stay stable even when the command changes.
  • TimescaleDB retention commonly uses a background policy that drops chunks older than a chosen interval.
  • Continuous aggregates can preserve summaries after raw chunks expire, but they need refresh windows and late-data rules.

Key terms

Prometheus local storage retention
Prometheus local storage retention is a monitoring setting, usually controlled by retention time or retention size flags.
iotclass.org

Major section

Partition-Aligned Deletion Mechanics

Retention is cheap only when the storage layout gives the engine a whole unit to remove.

  • In time-partitioned systems, old raw data should expire as a complete chunk, partition, shard, or block.
  • One raw day contains 3,456,000,000 points before indexes, replicas, metadata, and compression.
  • Boundary alignment is the trap.

Key terms

If chunks
If chunks are one day long and the approved cutoff is midnight UTC, the engine can drop whole day chunks.
iotclass.org

Major section

Partition-Aligned Deletion Mechanics (continued)

A row-by-row delete for that day has to evaluate billions of row-level decisions.

  • Dropping a one-day chunk removes the partition that already owns that time range.
  • If chunks are one day long and the approved cutoff is midnight UTC, the engine can drop whole day chunks.
  • Monitoring stores have the same idea with blocks: a Prometheus-style store removes old complete blocks, not arbitrary rows inside a block.
iotclass.org

Major section

Common Pitfalls

Storage pressure may start the conversation, but the retention contract belongs to the product, operations, compliance, and support owners.

  • The database job should implement an approved lifecycle decision.
  • An average without sample count, min, max, quality status, and gap markers can hide missing samples and incident spikes.
  • It may make a dashboard cheaper while making the system less explainable.
iotclass.org

Major section

Common Pitfalls (continued)

Backup helps recover the platform.

  • Retention design needs both concepts, but they are not the same artifact.
  • Retention commands and scopes differ across TimescaleDB, InfluxDB versions, Prometheus, managed services, and self-hosted deployments.
  • Teach the evidence model first, then confirm the exact implementation docs for the system being used.
iotclass.org

Major section

Summary

Data retention is the lifecycle discipline behind time-series systems.

  • It decides how long raw detail remains, what summaries replace it, what archive can be restored, which data is held, and when deletion is approved.
  • The strongest retention design is evidence-first: preserve quality in rollups, dry-run every deletion policy, restore a sample before trusting an archive, make holds visible to automation, and record owner approval.
  • That keeps storage manageable without letting quality drift or incident evidence disappear.
iotclass.org

Deck summary

Key takeaways

Telemetry means readings and status sent from equipment for remote use.

  • Under the Hood examines late arrivals, partition removal, refresh windows, platform commands, and the proof needed before detail is gone.
  • The hold gate then checks investigations, disputes, compliance rules, and warranty cases that still need raw detail.
  • Retention is implemented differently across systems.
  • Retention is cheap only when the storage layout gives the engine a whole unit to remove.
iotclass.org

Retrieval practice

Recall check 1 of 5

Data Dora says: answer from memory, then check your reasoning.

Q1Which retention release criterion is strongest before deleting raw telemetry?

AThe deletion job runs without throwing an error.
BRollups, restore, holds, and owner approval all pass.
CThe dashboard loads faster after old raw data disappears.
DThe database vendor supports a retention command.
Show answer

Answer: B Retention is safe only when the replacement evidence, restore path, query behavior, hold status, and owner decision are visible.

iotclass.org

Retrieval practice

Recall check 2 of 5

Data Dora says: answer from memory, then check your reasoning.

Q2How should the team handle retention for these two types of data?

AApprove it because every time-series retention setting has the same data role.
BDelete customer telemetry as soon as the gateway health chart loads.
CRename the metric labels so the monitoring store becomes a durable archive.
DKeep monitoring retention for health samples and prove a separate customer-history lifecycle.
Show answer

Answer: D Prometheus local retention serves monitoring; customer readings need their own archive and replay evidence.

iotclass.org

Retrieval practice

Recall check 3 of 5

Data Dora says: answer from memory, then check your reasoning.

Q3Why does a time-partitioned store use chunk- or partition-drop deletion instead of a large DELETE WHERE time < cutoff job?

ABecause row-level DELETE supposedly leaves query-visible index entries forever.
BBecause dropping an aligned time partition avoids billions of row-level delete decisions.
CBecause the partition boundary also establishes which archived records are safe to restore.
DBecause chunk dropping supposedly changes raw sensor sampling rates.
Show answer

Answer: B Retention is efficient when policy cutoffs align with chunks, partitions, or blocks; row-by-row deletes are the fallback to avoid.

Q4Complete the retention decision record with the evidence fields required before raw data can be deleted.

Araw_window: observed_at_range, late_arrival_window, hold_scope
Braw_window: page_theme, font_size, icon_color
Craw_window: delete_everything_immediately
Draw_window: unknown_timestamp_source
Show answer

Answer: A

iotclass.org

Retrieval practice

Recall check 4 of 5

Data Dora says: answer from memory, then check your reasoning.

Q5A team wants to shorten raw telemetry retention because storage is growing. What should they do before changing the deletion policy?

AChange the retention interval immediately because old data is probably less useful.
BRetain averages as the replacement evidence, since they preserve long-term trends while reducing storage.
CRely on a backup instead of an archive because both contain old data.
DRun a dry run, prove rollup coverage, restore a sample, and get owner approval.
Show answer

Answer: D Shortening raw retention changes what evidence remains available, so the release packet must prove the replacement path.

iotclass.org

Retrieval practice

Recall check 5 of 5

Data Dora says: answer from memory, then check your reasoning.

Q6A reading arrives after its time bucket was summarized but before raw data expires. What must the retention process do?

AMove the reading to the current bucket by arrival time.
BIgnore the reading because an earlier rollup exists.
CRefresh the old bucket in the late-data window before raw deletion.
DDelete the raw source and leave the old bucket unchanged.
Show answer

Answer: C A late reading must update the affected event-time summary while raw evidence remains.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. B · Retention is safe only when the replacement evidence, restore path, query behavior, hold status, and owner decision are visible.
  2. D · Prometheus local retention serves monitoring; customer readings need their own archive and replay evidence.
  3. B · Retention is efficient when policy cutoffs align with chunks, partitions, or blocks; row-by-row deletes are the fallback to avoid.
  4. A · raw_window: observed_at_range, late_arrival_window, hold_scope
  5. D · Shortening raw retention changes what evidence remains available, so the release packet must prove the replacement path.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. C · A late reading must update the affected event-time summary while raw evidence remains.
iotclass.org