Logbook takes forever to load

My logbook takes very long to load, this way it’s barely useable.

Is there a way to make it faster without including or excluding every entity by hand?

Exclude as much as possible,

Shorten the recording duration,

Move to an external Mariadb; this one improved mine a lot, dropping the loading time to under 20 seconds. Previously it would take so long it would time out.

Is it possible to only shorten the recording duration of the logbook? Probably not, right? I think the logbook pulls its data out ob the home-assistant_v2.db.
So I guess if I change the value of recorder: this will affect everything.

I still like to have the database record 2 weeks and only see one day in the logbook to make it faster.

I use influxdb and grafana. Maybe this helps?

Yes, if you change recorder duration you will affect everything.

So are there other ways? You said maria db? How would I do that and is is also possible with influxdb?

I just used this link

I just read there was speed advantages to using Mariadb over the native Innodb and I originally wanted to compress everything down to one database for all applications rather than 1 for each so I spun up a mariadb.
and it was definitely a lot different. Not sure about influxdb.

I use hassio, I don’t know if it’s possible to do this.
Also I don’t want to habe matiadb and influxdb.

Another question do you have two databases now? The one of HomeAssistant and Maria dB?

HA has an inbuilt database which to my knowledge can’t be replaced. The innodb database is separate and used to store the recorder entity states; this is the part I’ve moved.

HassIO appears to also support a mariadb addon

What is the “innodb”?

Innodb is the database storage component of MySQL. It is the structure of the database that makes it compatible with other SQL like database products.

I’m sry but I still don’t get it.

HA has an inbuilt database which to my knowledge can’t be replaced. The innodb database is separate and used to store the recorder entity states; this is the part I’ve moved.

Does this mean there is still “everything” in the inbuilt database and the things you have in mariadb are chosen by the recorder?
How to make changes to the inbulit database with recorder then?
If so, how do you tell the logbook to look at the mariadb database (where you chose certain entities) and not the inbuilt?

Also if I chose things to record in recorder, why shouldn’t I use that for the logbook. Whats the advantage of going through another db?

Again this is my understanding, but simply put

A) HA ‘internal’ stuff = database you can’t change where it goes. I havent looked what’s in there to be honest.
B) ‘Recorder’ data which includes all entity related information = by default uses an internal MySQL database but can be changed to any SQL compatible database. This is the one that gets huge (and slow) when you enable all entities to be recorded and have the data retention set for long periods of time.

Anything entity related that you access comes from database B. This is where the logbook and history comes from.

I see, thanks for making that clear.

I thought all of the entity data is in home-assistant_v2.db. Because this is the file that gets huge.

So if you use the recorder to record to your own database, it will stop writing to the default database right. Else it would use unnecessary space.

Yeah, I’ve deleted that file, it’s not been replaced.

1 Like

As I said I use influxdb, and probably you can’t help me with that, because you don’t use it, but I always wondered where influxdb saves its database.

Probably in its container (I’m a hassio user as I said)?

Feel free to vote for this enhancement and alleviate some of the slow SQLite DB behavior.

Currently using MariaDB and thinking of trying influxdb to compare speed. MariaDB takes anywhere between 15 seconds in daytime and 30 seconds for almost a 24 hour period.

1 Like

I think it would be better to start the query when an entity is selected first. So it would not take so long to load the logbook.

1 Like

The logbook in home assistnat has been a source of problems for many people for quite a long time.
It might be one of those things that can’t be fixed, but it would be good if it could be

1 Like