How to Delete Many Measurements with extrem long name in InfluxDB Efficiently

Hello Influx Community,

I’m new to InfluxDB and made a mistake with my Python script, creating 4000 measurements by accident. The names are very long, and I can’t delete them one by one in the server terminal. When I try using InfluxDBClient in Python, I get timeouts. I have already extracted the list of measurement names. I saw that regex is not supported for dropping measurements, and these measurements are either empty or have only one point.

What is the best way to delete these measurements efficiently?

  • i have influxDB 2.0
  • mesurement name ~8000 character (ex: MeasMeasMeas…local_1)


@Mine_RLax I think a little bash scripting the influx CLI will do the job for you. If you know the time range that these measurements contain points in, it will make it more efficient. But you can use the influx delete command. Something like this:


# Define the list of InfluxDB measurement names
    # Add more measurement names as needed

# Iterate through the measurement names and run influx delete command for each
for measurement in "${measurement_names[@]}"; do
    echo "Deleting measurement: $measurement"
    influx delete --predicate"_measurement=\"$measurement\"" --start="2024-01-01T00:00:00Z" --stop="2024-06-01T00:00:00Z"

This assumes you have the v2 influx CLI installed and your connection credentials are stored in a CLI config profile.

Hi Scott,
Thanks for the response, indeed I lost my credentials. Which is why I tried using python. But now I have them, so I’ll go and use your suggested approach.
Thank you for your help