Good Tutorial On Persistence (RRD4J and JDBC-MYSQL)?

It depends on what you want to do with the data. I use a three tiered rule of thumb.

Tier 1- use MapDB with restoreOnStartup for everything.

Tier 2 - use rrd4j for items I want to chart or need to check its previous state and the like in rules.

Tier 3 - use a “real” database for Items I want to study or analyze or use outside of OH or want to keep accurate data for long periods of time.

I actually do not use Tier 3 in my setup and only have a dozen or so items in Tier 2.

MapDB is good for Tier 1 because it is fixed size and can store non-numerical data. Rrd4j is nice because it is fixed size and data is accurate enough for most home automation purposes. I don’t really do analysis so I don’t know what I’d use for Tier 3. Probably MySQL because of familiarity or InfluxDB because it looks pretty capable.

The major thing driving my approach is to minimize storage requirements and minimize maintenance. With dbs like MySQL you have to periodically purge old data.

You can easily control which Items gets saved where by creating groups and setting up the .persist files to operate on those groups

4 Likes