content/shared/influxdb-v2/reference/syntax/delete-predicate.md
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.
key1="value1" AND key2="value"
{{% note %}}
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"
{{% /note %}}
{{% warn %}}
InfluxDB {{< current-version >}} supports deleting data by any column or tag except the following:
_time
{{% show-in "v2" %}}- _field{{% /show-in %}}_value{{% show-in "v2" %}}
InfluxDB {{< current-version >}} does not support deleting data by field.
{{% /show-in %}}
{{% /warn %}}
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 compare left and right operands and return true or false.
| Operator | Description | Example | Result |
|---|---|---|---|
= | Equal to | "abc"="abc" | true |
The following will delete points in the sensorData measurement:
_measurement="sensorData"
{{% show-in "cloud,cloud-serverless" %}}
The following will delete points with the temperature field:
_field="temperature"
{{% /show-in %}}
The following will delete points from the prod-1.4 host in the us-west region:
host="prod-1.4" AND region="us-west"
The delete predicate syntax has the following limitations.
OR logical operator.=), not inequality (!=)._time
{{% show-in "v2" %}}, _field, {{% /show-in %}}or _value.