"Normal" Database size and sensor log table location Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
User avatar
blitzkneisser
Posts: 43
Joined: Tuesday 01 December 2015 8:39
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Villach, Austria
Contact:

"Normal" Database size and sensor log table location

Post by blitzkneisser »

After having the malformed database problem I decided to clean things up as described here in the forum (http://www.dosomethinghere.com/2013/02/ ... malformed/)

Generating a new database from the SQL dump was so slow that - at that speed - it would have taken some hours to a day to generate the Database again. My domoticz.db is ~57MB big... is that normal for a Domoticz-System with ~260 devices (not separate devices, also counting multiple entries for different functions of 1 device)?

One culprit is for sure the 7 day sensor log. I found out, that for some sensors (mostly Temperature) this detailed logfile goes back to around 1st of December 2015. Having all values stored since then is for sure causing a gigantic database size. I first found the database table "LightningLog", but this one seems to contain only the last 30 days, so I guess that's the 30 day switches protocol - with ~120.000 entries. I started deleting everything except the last ~20%, already this is running for more than one hour so far ( not on the Raspy, on my Desktop PC).

So... in which table are the detailled sensor values stored? is there a possibility to delete everything but the last 7 days without losing the monthly/yearly statistics?

Edit: Just found it. "Temperature" contains ~530.000 Entries :)
So I guess the xxx_Calendar Tables contain the values for the monthly and yearly graph then?
User avatar
blitzkneisser
Posts: 43
Joined: Tuesday 01 December 2015 8:39
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Villach, Austria
Contact:

Re: "Normal" Database size and sensor log table location

Post by blitzkneisser »

Yay!
Fixing the database worked. It took half a day to generate the db file out of the SQL dump, and as the DB was then repaired, the numerous entries in the sensor log were purged automatically, so doing it automtically was no longer necessary.

The DB file still has the big size... is it purged/compressed automatically at some point in time or will I have to do that manually?
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: "Normal" Database size and sensor log table location

Post by Egregius »

I don't know when a vacuum accurs in Domoticz.
A backup/restore should do it I guess, or otherwise use a SQLite tool.

And also consider if you really need detailed logfiles of switches and sensors for that long period. Definnitelly with that number of devices.
My DB is only 540KB with 204 devices. Log is set to 2 days for both switches and sensors.
User avatar
blitzkneisser
Posts: 43
Joined: Tuesday 01 December 2015 8:39
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: Villach, Austria
Contact:

Re: "Normal" Database size and sensor log table location

Post by blitzkneisser »

No vacuum necessary, looks like that happened automatically. Now the DB size is down to 14MB (from 55MB) which is OK.
The long logfile (sensor log) only happened because of that DB error which prevented domoticz from deleting all sensor entries older than 7 days.
The Switch log for 30 days is not that big - but I think I'll reduce it to a shorter period - as well as the sensor log - as the number of devices is still prone to grow :-o
Especially now as I found out what the mysensors platform is actually capable of :)
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: "Normal" Database size and sensor log table location

Post by tjabas »

Can i delete all of the text content in the lightninglog without any problems, just to clear the log?
I also noticed that its possible to edit the z-wave table, can i change for example node 5 to 6 instead?
I thougt of rearange them so they will go from 1,2,3,4 and so on, as for now they are 3,8,10 and so on.

Thanks in advance.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: "Normal" Database size and sensor log table location

Post by waaren »

tjabas wrote: Tuesday 25 February 2020 15:16 Can i delete all of the text content in the lightninglog without any problems, just to clear the log?
If you first stop domoticz that should be OK. Just to stay on the safe side always make a copy of your database before manipulating data.
You can also limit the amount of history in this log by changing the values in [setup] [settings] [log History] tab
I also noticed that its possible to edit the z-wave table, can i change for example node 5 to 6 instead?
I thougt of rearange them so they will go from 1,2,3,4 and so on, as for now they are 3,8,10 and so on.
Please try and tell us if it worked or if it messed up your complete zwave configuration.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: "Normal" Database size and sensor log table location

Post by tjabas »

waaren wrote: Tuesday 25 February 2020 15:42
tjabas wrote: Tuesday 25 February 2020 15:16 Can i delete all of the text content in the lightninglog without any problems, just to clear the log?
If you first stop domoticz that should be OK. Just to stay on the safe side always make a copy of your database before manipulating data.
You can also limit the amount of history in this log by changing the values in [setup] [settings] [log History] tab
I also noticed that its possible to edit the z-wave table, can i change for example node 5 to 6 instead?
I thougt of rearange them so they will go from 1,2,3,4 and so on, as for now they are 3,8,10 and so on.
Please try and tell us if it worked or if it messed up your complete zwave configuration.
Do you think that changing the order of the z-wave nodes can casue the z-wave system to chrash?
If it casues a chrash i have a backup i can go back to, but do you think that the z-wave stick gen 5 might be fucked up to if i do these changes in the db file?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: "Normal" Database size and sensor log table location

Post by waaren »

tjabas wrote: Tuesday 25 February 2020 15:52 Do you think that changing the order of the z-wave nodes can cause the z-wave system to crash?
Sorry but I really have no idea and no intention at all to experiment with it to find out.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: "Normal" Database size and sensor log table location

Post by tjabas »

Today i tested to delete all content in the lightninglog and the Size of the db log wnt from 26mb to 6mb, how cone that this log has got so big? Shouldt to oldest events in the log get delete automaticlly?

And I didnt dare to change the z-wave config🙂
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest