#Is the electric dashboard history located outside the regular sqlite DB ?

1 messages · Page 1 of 1 (latest)

trim raven
#

the question is in the thread title. As the ha DB usually stores 10 days of historical data (including what the various charts are displaying), can someone please confirm where the electricity dashboard is stored ?

Thanks !

unique escarp
#

It is stored in the long term statistics, which are never deleted

#

These statistics are saved once per hour

#

The energy dashboard only calculates cost and stores it. All other data is read from the entities you configured

trim raven
#

thanks ! I didn't know that the default rtetention of the sqlite db was 10 days by the way

unique escarp
#

Retention doesn't apply to long term statistics

#

They are never deleted

trim raven
#

ok, I made a copy of the db, and started investigating using sqlite, I have absolutely NO state records, nothing

#
sqlite> SELECT COUNT(*) AS nombre_entrees_anciennes
   ...> FROM states
   ...> WHERE last_updated < datetime('now', '-10 days');
nombre_entrees_anciennes
------------------------
0
sqlite> SELECT COUNT(*) AS nombre_entrees
   ...> FROM states
   ...> WHERE last_updated BETWEEN datetime('now', '-9 days') AND datetime('now', '-8 days');
nombre_entrees
--------------
0
sqlite> SELECT
   ...>   DATE(last_updated) AS jour,
   ...>   COUNT(*) AS nombre_events
   ...> FROM
   ...>   states
   ...> WHERE
   ...>   last_updated >= datetime('now', '-10 days')
   ...> GROUP BY
   ...>   jour
   ...> ORDER BY
   ...>   jour ASC;


sqlite>
sqlite>
sqlite> SELECT COUNT(*) FROM statistics;
COUNT(*)
--------
6626974
#

But I do have a ton of statistics recordings...I mean, a LOT

#

the DB is above 2gb, which sounds quite big to me TBH

#

nothing above 10 days though... I believe I have to live with it.

unique escarp
#

2GB is big but not dramatic