Skip to content

0003 – PostgreSQL + pgvector as the only database

Status: accepted

Needed are relational data (rooms, devices, users, automations), flexible documents (configuration, event payloads), a durable job queue and vector search (memory, faces).

PostgreSQL 17 with pgvector: tables for relations, JSONB for flexible structures, vector(384) for embeddings, FOR UPDATE SKIP LOCKED for the job queue. SQLAlchemy 2 (async) + Alembic migrations at start.

  • SQLite: simpler, but weaker with concurrent writes; vector search only through extensions.
  • FerretDB/MongoDB + separate vector DB (Qdrant): additional services, no transactions across data and vectors.
  • Redis for the queue: another service without real benefit at this load.
  • One service for everything: a backup is one pg_dump (DEPLOYMENT.md).
  • Changing the embedding model to another dimension needs a migration and recalculation.