Switch Home Assistant to Use PostgreSQL Instead of SQLite

I wanted to switch my new Home Assistant (HA) installation to write data to PostgreSQL instead of SQLite for a variety of reasons. Here’s how I did it. Here’s why I decided to switch: Resilience. If you’re running Home Assistant on a Raspberry Pi’s SD card, the constant churn of history updates will eventually destroy the card. The more entities you have, the faster HA will grind your SD card to failure. Writing all that to another server that is writing to a real SSD or spinning disk eliminates that problem. Convenience. I can back up the postgres database without having to stop HA. I don’t even have to run the backup on the HA server. Speed. Using a real database will speed up history display, especially once you have a large number of entities. ...

November 5, 2022 · 5 min · 864 words · Me