Upgrade from SQLite to MySQL

My installation was getting slower so I decided to move to MySQL:

recorder:
  db_url: !secret database

Huge performance improvement! But I saw:

Database is about to upgrade. Schema version: None

In the logs, is that ok? I was always using SQLite, it automatically migrated all the data? Can I remove the home-assistant_v2.db? Or is it still used for other stuff? If not, will it cleanup after a while? The file is 8GB.

Is this upgrade proces documented somewhere?

The warning is harmless and should only print the first time when the database is created.

The database starts out empty, no migration happens. Your performance improvement is unfortunately likely to be due to having dropped all data and things will probably slow down again as it fills up.

You can delete home-assistant_v2.db, that is for SQLite only. It will not be cleaned up automatically.

1 Like

Thanks for the clarification! So in the database is only event data stored, where is the rest of the data? Like the users? I’ve downloaded the SQLite database to see which entities have the most records so I can exclude those.

The database is only for recorder/logbook/history. It’s a good idea to exclude entities.

Most configuration is in the <config>/.storage/ directory.

1 Like

Hello, I would like to migrate my sqlite database to Mariadb (Mysql), but I really want to do that for something.
Does the performance is really improve ?

Thank you !

1 Like

Most of the current logbook/history slowness is due to architectural issues that are shared for all databases. So a change of database is unlikely to give a huge performance boost.

I‘m looking for a bullet-proof, up to date (meaning HA 2021.12 release) guide on how to migrate all data from SQLite to MariaDB/MySQL database.

Maybe someone can guide on an up to date, proven guide.