Postgresql huge space used by openhab

Dear Sirs,

I’ve a raspberry with Openhab 3 running fine from 2021, for persistence I’ve setup a remote Postgresql 14 server but the openhab database has become huge 8 GB on disk.

Is there any cleaning tool in the addon (i.e. a setting to keep data for 365 days) ?

Thanks, BR

Amount of data depends on amount of probes you have. 8GB seems to be big number, however you can do some basic cleanups - first of all try running postgres vacuum to cleanup internal storage. Sometimes it helps.
Then, if you still have a lot of storage occupied - look for specific items which have frequent updates, such as power/temperature readings. Often dropping or averaging of past readouts for these items reduces store use by more than 50% (don’t ask how I learned that ;-))

Thank you @splatch, there were two itemxx who filled up that huge amount of space:

  • item01: a disabled camera item that was taking a snaphsot after another
  • item02: spotify track duration time that add a row each time a second is passed while playing a song

I didn’t find any “ignore for persistence” settings so I’ve deleted thos items and now everything seems light and clean.

Persistence configuration works the other direction. You can define what Items to save and how but you cannot define “every Item except…”. So if you want to exclude those Items, you’d need a custom .persist file that only includes those Items you do want to save.

One way to handle that a little more flexibly is through Design Pattern: Group Based Persistence. Then you can include/exclude Items from persistence through Group membership.

By default, is PostgeSQK is the same as InfluxDB, rrd4j, and MapDB in it’s default strategies, it will save all Items on every change with restoreOnStartup.

1 Like

4.0 ships some updates to item persistence configuration, if you are on earlier versions then you are probably victim of situation I was writing about back in August 2021:

1 Like