Search code examples
influxdb

How to get the number of entries in a measurement


I am a newbie to influxdb. I just started to read the influx documentation.

I cant seem to get the equivalent of 'select count(*) from table' to work in influx db.

I have a measurement called cart:

time                status  cartid          
1456116106077429261 0       A
1456116106090573178 0       B
1456116106095765618 0       C
1456116106101532429 0       D

but when I try to do

select count(cartid) from cart

I get the error

ERR: statement must have at least one field in select clause

Solution

  • I suppose cartId is a tag rather than a field value? count() currently can't be used on tag and time columns. So if your status is a non-tag column (a field), do the count on that.

    EDIT:

    Reference