Documentation

Data retention in InfluxDB 3 Core

InfluxDB 3 Core enforces database retention periods at query time. Any points with timestamps beyond a retention period are filtered out of query results, even though the data may still exist in storage.

Database retention period

A database retention period is the duration of time that a database retains data. Retention periods are designed to automatically delete expired data and optimize storage without any user intervention.

By default, data does not expire. When you create a database, you can optionally set a retention period. Retention periods can be as short as an hour or infinite (none).

Points in a database with timestamps beyond the defined retention period (relative to now) are not queryable, but may still exist in storage until fully deleted by the retention enforcement service.

Retention period duration formats

Retention periods are specified as duration values using a numeric value plus a duration unit. The retention period value cannot be negative or contain whitespace.

Valid duration units

UnitDescription
hhour
dday
wweek
momonth (30 days)
yyear (365 days)

Minute (m) and second (s) units are not supported for retention periods.

Retention period constraints

  • Minimum for data retention: The practical minimum retention period is 1 hour (1h).
  • Zero-duration periods: Setting a retention period to 0<unit> (for example, 0d or 0h) is allowed but marks all data for immediate deletion at query time. This differs from InfluxDB 1.x and 2.x where 0d meant infinite retention.
  • Infinite retention: Use none to set an infinite retention period.

Example retention period values

ValueDescription
1h1 hour
24h24 hours (1 day)
7d7 days
4w4 weeks (28 days)
1mo1 month (30 days)
90d90 days
1y1 year (365 days)
noneInfinite - data never expires

You can combine multiple duration units in a single value:

ValueDescription
30d12h30 days and 12 hours (30.5 days)
2w3d2 weeks and 3 days (17 days)
1y6mo1 year and 6 months (545 days)

Set database retention period

Use the influxdb3 create database command or the /api/v3/configure/database HTTP API endpoint to create a database with a retention period:

# Create a database with a 30-day retention period
influxdb3 create database --retention-period 30d 
DATABASE_NAME
# Create a database with infinite retention influxdb3 create database --retention-period none
DATABASE_NAME
# Create a database with a 90-day retention period using authentication influxdb3 create database \ --retention-period 90d \ --token
AUTH_TOKEN
\
DATABASE_NAME
# Create a database with a 30-day retention period
curl --request POST "localhost:8181/api/v3/configure/database" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer 
AUTH_TOKEN
"
\
--data '{ "db": "
DATABASE_NAME
",
"retention_period": "30d" }' # Create a database with infinite retention curl --request POST "localhost:8181/api/v3/configure/database" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer
AUTH_TOKEN
"
\
--data '{ "db": "
DATABASE_NAME
",
"retention_period": "none" }' # Create a database with a 90-day retention period curl --request POST "localhost:8181/api/v3/configure/database" \ --header "Content-Type: application/json" \ --header "Authorization: Bearer
AUTH_TOKEN
"
\
--data '{ "db": "
DATABASE_NAME
",
"retention_period": "90d" }'

Replace the following:

  • DATABASE_NAME: the name of the database
  • AUTH_TOKEN: your admin token

Retention periods are immutable in Core

In InfluxDB 3 Core, retention periods can only be set when creating a database and cannot be changed afterward. If you need to change a retention period, you must create a new database with the desired retention period and migrate your data.

Upgrade to InfluxDB 3 Enterprise for advanced retention features

With InfluxDB 3 Enterprise, you can set table-level retention policies and update retention periods after creation. For more information, see InfluxDB 3 Enterprise data retention.


Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.5

Key enhancements in InfluxDB 3.5 and the InfluxDB 3 Explorer 1.3.

See the Blog Post

InfluxDB 3.5 is now available for both Core and Enterprise, introducing custom plugin repository support, enhanced operational visibility with queryable CLI parameters and manual node management, stronger security controls, and general performance improvements.

InfluxDB 3 Explorer 1.3 brings powerful new capabilities including Dashboards (beta) for saving and organizing your favorite queries, and cache querying for instant access to Last Value and Distinct Value caches—making Explorer a more comprehensive workspace for time series monitoring and analysis.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On November 3, 2025, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2