Manage your data using InfluxQL

This page documents an earlier version of InfluxDB. InfluxDB v2.5 is the latest stable version. View this page in the v2.5 documentation.

Use the following data management commands to write and delete data with InfluxQL:

Write data with INSERT

The INSERT statement writes line protocol to a database and retention policy.


INSERT [INTO <database>[.<retention-policy>]] <line-protocol>
  • The INTO clause is optional. If the command does not include INTO, you must specify the database with USE <database_name> when using the InfluxQL shell or with the db query string parameter in the InfluxDB 1.x compatibility API request.


Insert data into the a specific database and retention policy

INSERT INTO mydb.myrp example-m,tag1=value1 field1=1i 1640995200000000000

Insert data into the a the default retention policy of a database

INSERT INTO mydb example-m,tag1=value1 field1=1i 1640995200000000000

Insert data into the currently used database

The following example uses the InfluxQL shell.

> USE mydb
> INSERT example-m,tag1=value1 field1=1i 1640995200000000000

Delete series with DELETE

The DELETE statement deletes all points from a series in a database.


DELETE FROM <measurement_name> WHERE [<tag_key>='<tag_value>'] | [<time interval>]

You must include either the FROM clause, the WHERE clause, or both.

  • DELETE supports regular expressions in the FROM clause when specifying measurement names and in the WHERE clause when specifying tag values.
  • DELETE does not support fields in the WHERE clause.


Delete all measurement data

Delete all data associated with the measurement h2o_feet:

DELETE FROM "h2o_feet"

Delete data in a measurement that has a specific tag value

Delete all data associated with the measurement h2o_quality and where the tag randtag equals 3:

DELETE FROM "h2o_quality" WHERE "randtag" = '3'

Delete data before or after specified time

Delete all data in the database that occur before January 01, 2020:

DELETE WHERE time < '2020-01-01'

A successful DELETE query returns an empty result.

If you need to delete points in the future, you must specify the future time period because DELETE SERIES runs for time < now() by default.

Delete future points:

DELETE FROM device_data WHERE "device" = 'sensor1" and time > now() and < '2024-01-14T01:00:00Z'

Delete points in the future within a specified time range:

DELETE FROM device_data WHERE "device" = 'sensor15" and time >= '2024-01-01T12:00:00Z' and <= '2025-06-30T11:59:00Z'

Delete measurements with DROP MEASUREMENT

The DROP MEASUREMENT statement deletes all data and series from the specified measurement and deletes the measurement from the index.


DROP MEASUREMENT <measurement_name>


Delete the measurement h2o_feet:


A successful DROP MEASUREMENT query returns an empty result.

The DROP MEASURMENT command is very resource intensive. We do not recommend this command for bulk data deletion. Use the DELETE FROM command instead, which is less resource intensive.

Was this page helpful?

Thank you for your feedback!

Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.