TSDB for InfluxDB® provides a complete set of statements for you to manage databases. This topic describes how to execute the
For more information about
SHOW statements, such as
SHOW DATABASES and
SHOW RETENTION POLICIES, see the Schema exploration topic.
The command-line interface (CLI) of TSDB for InfluxDB® is used in the examples that are provided in this topic. You can also use the HTTP API to run commands. To do this, send
GET requests to the
/query endpoint and use the
q parameter in the URL to specify the commands. For more information about the HTTP API, see the “Use the HTTP API to query data” topic.
You can execute the
DELETE statement to delete all the points of a series in a database. However, this operation does not delete the series from the index. In the
WHERE clause of the DELETE statement, you can specify the time interval based on your business requirements.
DELETE statement uses the following syntax. You must include at least one of the following clauses in the DELETE statement:
DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval>]
Delete all the data that is associated with the
> DELETE FROM "h2o_feet"
Delete the data where the tag value of the
randtag tag key is 3 in the
> DELETE FROM "h2o_quality" WHERE "randtag" = '3'
Delete all the data that is generated before January 1, 2016 in the database.
> DELETE WHERE time < '2016-01-01'
DELETE operation is successful, no result is returned.
Pay attention to the following considerations when you execute the
- You can use regular expressions to specify measurement names in the
FROMclause of the
DELETEstatement. You can also use regular expressions to specify tag values in the
WHEREclause of the
- You cannot specify fields in the
WHEREclause of the
- If you need to delete the data that is generated after the time returned by the
now()function, you must specify the corresponding time period. This is because the
DELETE SERIESstatement deletes the data that is generated before the time returned by the now() function (
time < now()) by default.
InfluxDB® is a trademark registered by InfluxData, which is not affiliated with, and does not endorse, TSDB for InfluxDB®.