FHEM - Hardware > Einplatinencomputer
DbLog patch to minimize flash wear
Fuzzy:
Hi,
I'm using SQLite with the DbLog module on my RPi. On a small embedded device like this minimizing writes to reduce wear on flash storage and save IO bandwidth is important. So I have created the attached simple patch to 93_DbLog.pm that
- Moves the 'current' table to memory and modifies a few internal parameters in SQLite to minimize flash wear.
- Makes easier to setup DbLog with SQLite. Database tables are created automatically when the database is opened.
I have also added an event-on-change-reading attribute to all the devices in fhem.cfg to log only changes e.g.:
--- Code: ---
define TEMP.Bedroom TRX_WEATHER TFATS34C_4b_14
attr TEMP.Bedroom event-on-change-reading temperature,humidity
--- Ende Code ---
Br,
Peter
justme1968:
i just saw your patch...
the index seems to make a huge difference. i think i like it.
one more question: how does the temp table work? should i drop the regular current table?
thanks
andre
Fuzzy:
Temp tables are only visible in which database connection they were created. When you close the database connection the table disappears. SQLite is not a separate server so it only happens if you restart FHEM, but no reading data lost as it is kept in the history table...
And yes you have to drop your existing 'current' table.
Br,
Peter
Tobias:
i will move your patch to the official dblog module
best regards
Fuzzy:
Thanks. I'm working on a newer patch that combines the inserts into one transaction, and improves the event parsing method.
Shall I post it here or another part of the forum?
Br, Peter
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln