<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt" -->

---
title: I replaced Home Assistant's built-in database with...
description: Home Assistant's default SQLite database struggles when you have 50+ devices, causing 5–10 second delays when loading history graphs due to write lock...
canonical: https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I replaced Home Assistant's built-in database with PostgreSQL, and my smart home finally feels snappy | daily.dev
og:description: Home Assistant's default SQLite database struggles when you have 50+ devices, causing 5–10 second delays when loading history graphs due to write lock...
og:url: https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt
og:image: https://api.daily.dev/og/posts/HJqZr1Zxt.png
og:image:alt: I replaced Home Assistant's built-in database with PostgreSQL, and my smart home finally feels snappy
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I replaced Home Assistant's built-in database with PostgreSQL, and my smart home finally feels snappy

**[XDA Developers](https://daily.dev/sources/xda-developers)** · 3 min read · 0 upvotes · 0 comments

## Summary

Home Assistant's default SQLite database struggles when you have 50+ devices, causing 5–10 second delays when loading history graphs due to write lock contention and DML overhead. Switching to PostgreSQL resolves this by supporting concurrent reads and writes, enabling decoupled I/O on a secondary host, and allowing hot backups without downtime. The migration involves deploying PostgreSQL via Docker Compose or the HA add-on store, creating a dedicated user and database with PSQL commands, and updating the recorder section in configuration.yaml with the new connection string.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.xda-developers.com/replaced-home-assistants-built-in-database-postgresql-smart-home-snappy>

## Questions this post answers

### How do I switch Home Assistant's recorder from SQLite to PostgreSQL?

Deploy a PostgreSQL instance via Docker Compose, a NAS container, or the official Home Assistant add-on store, then create a dedicated database user with CREATE USER and CREATE DATABASE commands. Update configuration.yaml's recorder section with db_url set to postgresql://user:password@host:5432/dbname and a purge_keep_days value, then restart Home Assistant.

_daily.dev surfaces practical guides like this for smart home tinkerers tuning their self-hosted setups._

### Why does Home Assistant's history and logbook load slowly with many devices?

SQLite stores the entire state history in a single flat file, so write-heavy sensors like power meters logging wattage every second cause lock contention that blocks read operations needed to render history graphs. High DML overhead means hundreds of simultaneous insert statements per minute back up write queues, degrading performance once a setup grows past around 50 devices.

_developers debugging sluggish self-hosted dashboards can find similar diagnostics on daily.dev._

## Similar posts on daily.dev

- [I Replaced Redis with PostgreSQL \(And It's Faster\)](https://daily.dev/posts/i-replaced-redis-with-postgresql-and-it-s-faster--x7d3o8vu2) · Lobsters · 744 upvotes · 61 comments
- [Home Assistant slows down over time, but there's a nuclear option most people don't realize](https://daily.dev/posts/home-assistant-slows-down-over-time-but-there-s-a-nuclear-option-most-people-don-t-realize-nmwpwbbbf) · XDA Developers · 0 upvotes · 0 comments
- [You can outgrow vanilla Postgres without abandoning Postgres](https://daily.dev/posts/you-can-outgrow-vanilla-postgres-without-abandoning-postgres-inzvfgbdt) · The New Stack · 2 upvotes · 0 comments

---

Tags: [#tech-news](https://daily.dev/tags/tech-news), [#backend](https://daily.dev/tags/backend), [#postgresql](https://daily.dev/tags/postgresql), [#sqlite](https://daily.dev/tags/sqlite)

[View this post on daily.dev](https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I replaced Home Assistant's built-in database with PostgreSQL, and my smart home finally feels snappy","url":"https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt"},"datePublished":"2026-08-10T18:31:27.063Z","dateModified":"2026-09-14T06:29:27.538Z","description":"Home Assistant's default SQLite database struggles when you have 50+ devices, causing 5–10 second delays when loading history graphs due to write lock...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/49cb15f82f49f215ba6acb0632e4a86b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/49cb15f82f49f215ba6acb0632e4a86b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"XDA Developers","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"XDA Developers","logo":"https://media.daily.dev/image/upload/s--kCg6yyAP--/f_auto,q_auto/v1774964407/logos/xda-developers?_a=BAMAMiWQ0","url":"https://daily.dev/sources/xda-developers"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"tech-news,backend,postgresql,sqlite","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"XDA Developers","item":"https://daily.dev/sources/xda-developers"},{"@type":"ListItem","position":3,"name":"I replaced Home Assistant's built-in database with PostgreSQL, and my smart home finally feels snappy"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-replaced-home-assistant-s-built-in-database-with-postgresql-and-my-smart-home-finally-feels-snapp-hjqzr1zxt#faq","mainEntity":[{"@type":"Question","name":"How do I switch Home Assistant's recorder from SQLite to PostgreSQL?","acceptedAnswer":{"@type":"Answer","text":"Deploy a PostgreSQL instance via Docker Compose, a NAS container, or the official Home Assistant add-on store, then create a dedicated database user with CREATE USER and CREATE DATABASE commands. Update configuration.yaml's recorder section with db_url set to postgresql://user:password@host:5432/dbname and a purge_keep_days value, then restart Home Assistant. daily.dev surfaces practical guides like this for smart home tinkerers tuning their self-hosted setups."}},{"@type":"Question","name":"Why does Home Assistant's history and logbook load slowly with many devices?","acceptedAnswer":{"@type":"Answer","text":"SQLite stores the entire state history in a single flat file, so write-heavy sensors like power meters logging wattage every second cause lock contention that blocks read operations needed to render history graphs. High DML overhead means hundreds of simultaneous insert statements per minute back up write queues, degrading performance once a setup grows past around 50 devices. developers debugging sluggish self-hosted dashboards can find similar diagnostics on daily.dev."}}]}
```

