Our Home Control System stores a lot of information about things like current sensor states, when things were last turned on or off, opened or closed, etc. All of this is stored in a secure, high performance, local database.
We wrote a Java 'wrapper' class for all of the database functions to enable it to be implemented in a very flexible manner and ended up also writing our own caching database, to minimise disk reads and writes. It has a very small footprint and very good performance. It has also been designed to use a local USB pendrive, to maximise reliability and lifetime of SD cards and solid-state disk (SSD). This also has the added benefit of making it very easy to backup.
Examples include things like when the heating was last turned on or off.