- An InfluxDB
measurement
is similar to an SQL database table. - InfluxDB
tags
are like indexed columns in an SQL database. - InfluxDB
fields
are like unindexed columns in an SQL database. - InfluxDB
points
are similar to SQL rows.
So I have a database called domotica
with the following measurements:
- The
environment
measurement contains all of my sensor data - I have a couple of tags:
location
andtype
- Location tags are real places such as "Kitchen"
- type tags are sensor measurement types such as "Temperature", "Humidity", "Light", etc.
- I typically have only 1 field called
value
Typically a tag will contain text, a field will contain a number. Try to make sure you get that right because correcting the data type of a field is a right pain.
Here are some example retention policies
You may wish to accumulate long-term data into another measurement within your database with a continuous query such as:
CREATE CONTINUOUS QUERY cq_60min ON domotica BEGIN SELECT mean(value) AS value, max(value), min(value), max(value) - min(value) AS range INTO domotica.one_week.env_daily FROM domotica.twenty_four_hours.environment GROUP BY location, type, time(1h) END
Which summarises the 1 minute sensor values from domotica.twenty_four_hours.environment
which are kept in that measurement for 1 week - into hourly values in domotica.one_week.env_daily
, keeping average, max and min values for each 1hr time period.