TRUNCATE like command?

Hey guys,

Somewhat new to influxdb and I was wondering is there a TRUNCATE like command at all? I have an influxdb I want to truncate and completely reset to an empty state on a deployment of some new code.
Only way I can see to make this happen is via a drop and create however this causes issues with the app’s current codebase.


I am not aware of any. But does not mean a thing because I am new here :wink:

What I currently use is “DELETE FROM [MEASUREMENT_NAME]”
You should know all measurements you use. Otherwise a “SHOW MEASUREMENTS” will tell you.

Best regards

Hello @lukekhamilton,
Thank you for your question. You can drop a database or delete a series. Since InfluxDB is an append-only DB, it doesn’t have as many management commands as SQL. Please take a look at the InfluxDB docs here.

Hi @Anaisdg,

DELETE and TRUNCATE are only for InfluxQL? Are there any equivalent for Flux, since I presume that is the only query language for InfluxDB 2.0. There is the drop() function for Flux, but I tried the following and it is not working for me. The data is still there:

from(bucket: “aq-raw”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> drop(columns: ["", “_measurement”])

I guess maybe that query function isn’t needed in 2.0, because you can set the data Retention policy? Even so, I would still like to have that DELETE ALL control on hand just in case.

Hey @Kevin-Chen0,
Please take a look at this other community question for your answer. Thanks!