---
title: Retention policies
slug: reference/retention-policies
docTags: 
createdAt: 2025-09-05T11:31:35.235Z
---

A retention policy is the part of the InfluxDB data structure that describes for how long InfluxDB keeps data.

## Changing the default retention policy on an InfluxDB 1.8.x database

1. open a terminal and run influxDB
2. type `auth` followed by the admin credentials to authenticate
3. type `use _internal_factry` to select the database (replace `_internal_factry` with the database of your interest)
4. type `SHOW RETENTION POLICIES` to list the retention policies configured for the database
5. type `ALTER RETENTION POLICY <policy> ON _internal_factry DURATION 12w REPLICATION 1 DEFAULT` to change the duration of the retention policy, using the policy name from the previous step. Replace 12w with the duration of interest. For the internal database the policy to change is `_internal_factry_rp`, not `autogen`: Factry Historian creates that policy as the default when it provisions `_internal_factry`, so `autogen` holds no data there. Regular databases holding measurement data get no policy of their own, so for those `autogen` is the one to change. More info on the duration format [here](https://docs.influxdata.com/influxdb/v1.8/query_language/spec/#durations) .
6. type `SHOW RETENTION POLICIES` to verify your changes

### Example

```bash
bash-5.1# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> auth
username: factry
password:
> use _internal_factry
Using database _internal_factry
> SHOW RETENTION POLICIES
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        true
> ALTER RETENTION POLICY autogen ON _internal_factry DURATION 12w REPLICATION 1 DEFAULT
> SHOW RETENTION POLICIES
name    duration  shardGroupDuration replicaN default
----    --------  ------------------ -------- -------
autogen 2016h0m0s 168h0m0s           1        true
```
