Setting up postgres

I miss the requirement to setup postgres first and adjust the recorder setting - can you please elaborate
I have difficulties setting it up as it does not record anything in the postgres db

Did you take a look at the recorder docs or the forum?

yes, database has been created using postgres and I have the following in my recorder.yaml
db_url: postgresql://user:[email protected]/hassdb

tried even with another paswordless db
db_url: postgresql://@/hass

both databases are not being populated

Did you double check your permissions? Do you get any errors in the HASS logs?

Btw., you don’t need postgres for the data science stuff.

no error in hass, nor permission errors in the log file of has or postgress

INFO (MainThread) [homeassistant.bootstrap] Home Assistant core initialized
INFO (MainThread) [homeassistant.loader] Loaded recorder from homeassistant.components.recorder
INFO (MainThread) [homeassistant.setup] Setting up recorder

db-size still remains 7mb after 48hrs

postgres-# \l+ hass
                                               List of databases
 Name | Owner | Encoding |   Collate   |    Ctype    | Access privileges  |  Size   | Tablespace | Description 
------+-------+----------+-------------+-------------+--------------------+---------+------------+-------------
 hass | hass  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/hass          +| 7077 kB | pg_default | 
      |       |          |             |             | hass=CTc/hass     +|         |            | 
      |       |          |             |             | datascience=c/hass |         |            | 
(1 row)

ps- which db does datasience need ?

Could you please post your full recorder config and more information about your system? What platform is HASS running on? What version?

The data science stuff needs no particular database. I just needs to be pointed at the database that HASS is using.

as the hass user can you “psql hass” on the shell? Did you also installed psycopg2?

Currently I have postgres 9.4.9 with HASS. Postgres 9.5 introduced BRIN indexes that should be optimal for append-only IOT-tables like HASS has. They work with ordered timestamp columns like time_changed. Has anyone got 9.5 with BRIN indexes and was there any problems?

Seems that Grafana now has also Postgres-connection.

I have installed postgres on another server and I want to use recorder integration but in the instruction it clearly says I need psycopg2. The command for it is pip3 install psycopg2. You can read it here: recorder/#postgresql
But the hass.io does not have pip3, it does not have apt to install it either. How on earth I can connect to postgres from hass.io?

I was worried that when I restart HA and psycopg2 will not be there, the service will not start. Anyway, I have restarted and it worked straight away. So it looks like hass.io has psycopg2 preinstalled and it can work with Postgres out of the box. Just add your recorder info into config, setup DB on Postgres and you are all set.