Logbook slow on initial query and then fast

I am running HA 2023.4.4 on an 8GB RPi8 with an SSD. I have configured HA to use a local MySQL DB (running a separate server on my LAN) to hold data. Everything is running smoothly except I see an issue that I cannot explain. Here is a description:

Open the logbook and it loads instantly with default date range
Select new date/time range and click submit
Load wheel spins forever and nothing happens
Click back to go back to logbook with default range
Select same date/time range as #2 and click submit
Data appears instantly

So my question is why do I get the spinning wheel that never shows any data the first time, and yet the second time, I get the data instantly. Trying out different timing, it seems that it does not matter how long I let the first date range spin, and that the second time range selection is always instant.

Any idea what is going on and how to fix it?

Hi, I was about to open a new thread about the same problem, when I’ve found yours.

The same is happening to me, with HA 2023.8.4 on a QNAP NAS with Docker. The history always loads instantly, so it’s not a matter of a big database I think.

I can replicate 100% your description, but the fact nobody replied probably means we’re the only one that are affected or noticed? The issue exists on every platform and I’ve tried with Firefox and Chrome and it doesn’t make any difference.

Should we open a issue on GitHub?

Here’s an example occurred today (it happens also with the Android HA app).

Pay attention that at the beginning, when loading today’s logbook for the first time (00:00-23:59), the spinning icon appears and spins indefinitely.
After changing to another tab (History in the example) and then back, the same logbook loads instantly, both in the range 12:00-15:00 and the previous 00:00-23:59.

HA_Logbook_Issue

I think that opening a Github case is a good idea. I never got to that. To your point, no one every responded here and so it seems like not everyone experiences this. Mind linking the Github case here so we can track it?

I thought so, but they force me to upgrade to the latest version of Home Assistant. In my current setup I’m on 2023.8.4 and cannot upgrade quickly.

I tried building a VM with the latest HASS OS and uploading the backup of my HA 2023.8.4; the first time I accessed the logbook I was able to replicate the issue… but then it loaded correctly.

Unfortunately it’s difficult to replicate the behaviour when you want it. Argh!

Darn! I keep hoping that it will disappear, but I saw it again last weekend.

With the latest HA version, right?

Yes, I always stay current.

1 Like

So, if you understand how to “trigger” the issue let me know and I’ll try that too.

Seeing slow Logbook constantly. It became slow more at least a year ago.
Even opening a “sun.sun” for 48 hrs could last a minute.

My logbook is incredibly slow. I’ve been trying to pull up 24 hrs of history for one entity — a light bulb I rarely turn on — and it’s been stuck for several minutes.

Add me to the “Me Too” list for this issue!

Raspberry Pi 3 with 1GB memory, running on MicroSD - SanDisk 64GB Extreme PRO microSDXC card UHS-I Class 10 U3 V30

  • Core 2024.2.1
  • Supervisor 2024.01.1
  • Operating System 11.5
  • Frontend 20240207.1

If you are able to replicate this issue every time, try to capture a video recording with the console data of the browser visible (F12 key to open developer tools and then Console) so you can then open an issue on the frontend.

Unfortunately I was able to record only the video that time and I’m not able to trigger the issue when I would want to!

I’m not been able to repro it (hence the late reply)

I have Pi4B with 8GB on the way, so will test it to see if it’s hardware issue or something else.

would like to share my experiences with you
When I played with the logbook recently it was actually unusable.
When I opened it, the log entries for the current day came immediately.
But if I changed the date (time range) in the calendar, the hourglass ran indefinitely.
First I only filtered on the three columns Start Date, End Date and Entity.
That’s not how it worked.
Then I clicked on the calendar symbol and selected Yesterday or “This Week”.
Since then, it has worked – also with the other three columns

My Setup

  • Raspberry Pi 4 / 8 GB
  • Home Assistant OS: Version 11.5
  • Core 2024.3.1
  • Add-On: MariaDB

That’s the same problem this thread is about. Once you “loaded” the other days, it’s fast, but the first time you change the date (not including the first load) it doesn’t work.
You must go away on another tab and then come back to show the results.

I’ve been having this happen too. Just I my phone right now, but will try again from a PC later

1 Like

Try to capture a video with the browser developer tools, if you are able to (it’s difficult because the issue must happen when you are actually recording).

Otherwise I think we cannot open an issue on the GitHub frontend, they won’t believe us if the problem is not replicable. That’s the reason why I still didn’t open it, I have no evidences yet.

I get this exact same issue. I assume it was never resolved?