Historical data suddenly missing

I would need some help.
My historical data for every entity is suddenly missing. They starting storing the data again between 4am and 12am today. Bevore that, everythin is missing.

Why would that happen and how can i prevent that in the future?

Additionally i wanted restore my data by uploading a recent backup. It was about 1.3GB in size. My Homeassistant Green was stuck loading for two hours until i canceld the restore.

Why would that happen?

4am hour is when HA cleans up the database and does the auto backup. Perhaps there was DB corruption that took longer to repair.
If you are using a rasPI with an SD card I would tell you the SD card might be struggling. If that’s not the case, there are other causes of DB corruption.