InfluxDB – Getting only last value in query

If you are using InfluxDB 0.8 dont use FIRST() or LAST() if you have not GROUP BY because its very slow 🙁

So if you want to get the these Values you shoud use:

First Value:

SELECT * FROM <SERIES> GROUP BY * ORDER BY ASC LIMIT 1

Last Value:

SELECT * FROM <SERIES> GROUP BY * ORDER BY DESC LIMIT 1

Don’t delete the GROUP BY * because then it could be possible that you get unexpected values then.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)