count() function

The count() function outputs the number of records in each input table and outputs the count in the specified column. The function counts both null and non-null records.

Function type: Aggregate
Output data type: Integer

count(column: "_value")

Empty tables

count() returns 0 for empty tables. To keep empty tables in your data, set the following parameters for the following functions:

filter()onEmpty: "keep"
window()createEmpty: true
aggregateWindow()createEmpty: true



The column on which to operate. Defaults to "_value".

Data type: String


from(bucket: "example-bucket")
  |> range(start: -5m)
  |> count()
from(bucket: "example-bucket")
  |> range(start: -5m)
  |> count(column: "_value")

Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.