State history not loading or taking too long to load

I have a some history plots that sometimes take too long to load or don’t load at all

I am using Hassio on a Raspberry PI 3+

What can I do to fix this?