Documentation

Delete predicate syntax

InfluxDB uses an InfluxQL-like predicate syntax to determine what data points to delete. InfluxDB uses the delete predicate to evaluate the series keys of points in the time range specified in the delete request. Points with series keys that evaluate to true for the given predicate are deleted. Points with series keys that evaluate to false are preserved.

A delete predicate is comprised of one or more predicate expressions. The left operand of the predicate expression is the column name. The right operand is the column value. Operands are compared using comparison operators. Use logical operators to combine two or more predicate expressions.

Example delete predicate
key1="value1" AND key2="value"

Predicates with special characters or keywords

If your predicate contains keywords or strings with special characters, wrap each in escaped quotes to ensure the predicate string is parsed correctly.

Because delete predicates follow InfluxQL syntax, any InfluxQL keyword that matches your tag name needs to be escaped. Keywords are case-insensitive.

// Escaped due to the "-"
"_measurement=\"example-dash\""

// Escaped because "Name" is a keyword
"_measurement=example and \"Name\"=predicate"

Column limitations when deleting data

InfluxDB Cloud supports deleting data by any column or tag except the following:

  • _time
  • _value

Logical operators

Logical operators join two or more predicate expressions.

Operator Description
AND Both left and right operands must be true for the expression to be true.

Comparison operators

Comparison operators compare left and right operands and return true or false.

Operator Description Example Result
= Equal to "abc"="abc" true

Delete predicate examples

Delete points by measurement

The following will delete points in the sensorData measurement:

_measurement="sensorData"

Delete points by field

The following will delete points with the temperature field:

_field="temperature"

Delete points by tag set

The following will delete points from the prod-1.4 host in the us-west region:

host="prod-1.4" AND region="us-west"

Limitations

The delete predicate syntax has the following limitations.

  • Delete predicates do not support regular expressions.
  • Delete predicates do not support the OR logical operator.
  • Delete predicates only support equality (=), not inequality (!=).
  • Delete predicates can use any column or tag except _time or _value.

Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB Clustered

A highly available InfluxDB 3.0 cluster on your own infrastructure.

InfluxDB Clustered is a highly available InfluxDB 3.0 cluster built for high write and query workloads on your own infrastructure.

InfluxDB Clustered is currently in limited availability and is only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Learn more
Contact InfluxData Sales

The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following:

InfluxDB Cloud powered by TSM