Duplicate data, how much of a waste is it?

Hi all!
I’m using Influxdb to store the state of all the sensors/lights/etc. of my home automation system for debug purpose and most of the time the data of sensors doesn’t change, how does Influxdb handle this data? Does it store all the values or does it ignores until those change? If it stores all the value, is it in a “compressed” intelligent way or it just duplicates them?

InfluxDB stores all of the data which is fed into it. It does not “fill in
gaps” on its own.

If you feed in data whenever a switch state changes, you have a list of switch
state changes.

If you feed in the state of the switch every minute, you have one value every
minute telling you the state of the switch at that time.

My recommendation to people is always to feed into the database the same type
of information that they want to get out of it afterwards - so if you’re
interested in the state of a switch over a continuous period of time, store
the state of the switch at whatever intervals you need. If you are only
interested in when something changes, then store that instead.


1 Like

Thanks for the explanation!

I would have thought people would discourage me to insert all those values even if there is no change. Why do you suggest that

Suppose you have some sensor (maybe a light switch, maybe a water meter, maybe
an intruder alarm) and you store a value from it when it changes.

Then, later on, you want to plot a graph showing “when was the light on?” or
“how much water is in the tank?” or “when did someone break in?”.

You display this graph over, say, a 24-hour period.

The display system has no idea what state the thing is in at the start of the
period, until something changes. If there is no change during those 24 hours,
there is nothing to display.

So, can you end up with a graph which cannot tell you whether the light is on
or not, how much water is in the tank, and whether someone has broken into the
house, until you expand the timescale, and manage to find some period during
which a change does occur.

In my experience people far too often store state changes when what they want
to know afterwards is “what was the value at each minute/hour/day/whatever?”
over some period of time, and this simply makes life difficult.


1 Like

Right, I haven’t thought about that, thanks!!!