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

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

## Changing the default retention policy on an InfluxDB 1.x.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 by the database of your interest)
4. type `SHOW RETENTION POLICIES` to list the retention policies configured for the database
5. type `ALTER RETENTION POLICY autogen ON _internal_factry DURATION 12w REPLICATION 1 DEFAULT` to change the duration of the retention policy. Replace 12w with the duration of interest. 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
```

