influxdb

Delete old influxDB data


I have an influxDB instance with more than 4 years of data (∼ 600GB) which causes very high memory consumption (more that 100GB of RAM). I want to delete data older than a year to reduce memory usage. I wanted to use retention policy but as far as I know newly created RPs only affect newly inserted data. I decided to go with deleting old data manually like this:

DELETE FROM \"$measurement\" WHERE time < 'YYYY-MM-DD'

with $measurement looping through all measurements in the database.

Is this the correct way to do it or there is a better way?


Solution

  • if you are using default RP, you can change it to 1 year, which will delete the existing data.