Storing weather information in influxdb based on the time stamp of the sensor, I need to determine the min and max values for every 24 hours of data collected. The problem being I want the actual time stamp for the min temp or max wind speed, and not the one that is returned during the GROUP BY 24hr. Is there anyway to do this within influxdb? Is it possible to store the timestamp as an additional field and have a second field returned (the additional timestamp) with the corresponding min() or max() value query? Thanks!
max() selectors when querying InfluxDB will return the respective field value associated with the field key passed in as the argument along with the associated time stamp. Please check out the documentation here on
Thank you for the quick response.
So my specific query is:
CREATE CONTINUOUS QUERY “fl_minmax” ON “weather_stations” RESAMPLE EVERY 5m BEGIN SELECT min(tdry_fl) as “tdry_fl_min”, min(wdir_fl) as “wdir_fl_min”, max(tdry_fl) as “tdry_fl_max”, max(wdir_fl) as “wdir_fl_max” INTO “fl_minmax” FROM “fl” GROUP BY time(24h) END;
and to ensure back filling of data that is not real time (time is collected from the sensors and not when inputted into the database):
SELECT min(tdry_fl) as min(tdry_fl) as “tdry_fl_min”, min(wdir_fl) as “wdir_fl_min”, max(tdry_fl) as “tdry_fl_max”, max(wdir_fl) as “wdir_fl_max” INTO “fl_minmax” FROM “fl” WHERE (time >= ‘2018-01-01’) AND (time <= now()) GROUP BY time(24h);
but this yields a time stamp on the every five min value, or just at 00:00 for the SELECT query. Am I querying it incorrectly?