# Retention

# Retention

Drillmark does not run an automatic retention sweep today. Operators who need to bound database size prune rows directly.

## What grows

- `raw_reports` (the `BYTEA` column holding the untouched XML or JSON). Dominant contributor.
- `parsed_records` and the per-type report tables.
- `alerts_sent`, `job_runs`, `email_processing_logs`. Smaller, but they accumulate forever without pruning.

## Pruning

A typical schedule for a self-hosted MSP deployment:

- Delete `raw_reports` older than N days once their parsed rows are in place. The parsed rows and the blob are linked by foreign key; drop the blob rows, keep the parsed records.
- Trim `alerts_sent` and `job_runs` to the last M days to keep the UI responsive.
- Leave `parsed_records` alone unless disk pressure is a problem. Analytics read directly from them.

Pick the values that match your audit requirements. The schema does not enforce or suggest any particular retention.

## Geolocation database

The IP2Location LITE download at `IP2LOCATION_DB_PATH` refreshes monthly on the vendor's side. Replace the file in place (overwriting the mounted path) and the geolocation job picks up the new dataset on its next run; no restart is needed. Unset `IP2LOCATION_DB_PATH` to disable enrichment entirely; the job stops running and existing enrichment stays in place.

## Future

A configurable retention sweep is tracked internally; until it ships, manual pruning via SQL is the path.
