How to easily delete ranges of data?



I have a big influxdb database and i want do delete some unused metrics, but not whole days, only hour ranges of every days:

  • i just want to keep the 09h00PM-> 11H00PM range hour in database.

What is the more secure an easy way to do it?


Hi there,

It seems like the best way to do this would be to set up an appropriate retention policy to drop data once it’s no longer useful, and in the meantime, set up a continuous query or run a Kapacitor TICKscript to maintain the data you do want to keep (in the 09h00PM -> 11H00PM time range).

You can read about retention policies here.
You can read about continuous queries here.
You can read about getting started with Kapacitor here.

If you need to delete the data manually, you’ll need to first set up a continuous query to save your specified time range of data, and then you can drop whole series manually, using:

DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval>]

For more information on deleting series, please see this documentation.

Good luck!