Slow SELECT COUNT query?

Hi!

I am new at Influx and I am not sure what to expect in terms of performance. My DB is running on the Standard I InfluxCloud tier.

I am trying to query a measurement to know how many records I have in it.

My query is
SELECT COUNT(messageId) FROM <MEASUREMENT_ID> WHERE time > NOW() - 10d GROUP BY time(1d)

It takes over one minute to complete, on a measurement with 40 millions records. Is it expected or am I doing anything wrong ?

I understand that select count is performing very poorly on a TSDB but I am not sure if there is a better way to count the number of data points that are being collected.

Thanks!

Also, a
SELECT FIRST(field) FROM

query for the same measurement is quite slow, at 13s. What can I try to improve things ? The explain plan doesn’t bring much info

Mine took around 3 to 4 seconds (see the output)
image

And with FIRST it was less than a second.
Not sure for you if the latency is due to network, try debugging the web request time.

Total 7297653 records

Hello,Guillaume_Lachaud. Do you have find the reason why it is so slow?

Hello,Guillaume_Lachaud. Do you have find the reason why it is so slow?