Database partitioning

Greetings to all community.

(I’m running HASS Core on a dual core ARMHF Linux which 2Gb of RAM)

I’m using MySQL/MariaDB storing data in RAM (using a mounted partition in ram which is synced/backupped to physical partition once per day to avoid continuous mmblck writes) but STATES and EVENTS tables contains Foreign Keys and cannot be partitioned due to MySQL/MariaDB limitations.
I tried to partition these tables because database grows 200Mb each day and in few days RAM Partition became full so I would like to store them in a dedicated “old” partition and leave the “IN-RAM” partition only for current day data.

I tried to remove Constraint Foreign Keys before do partitioning but something doesn’t work well on HASS after this, so I’m here to ask for support this:

  • a second STATES and EVENTS tables for storing “old” data which are looked up together the normal ones. (maybe something like “UNION” query)

In this way it will possible to store newest data in default tables and old data in a different tables without loosing the possibility to view History from HASS interface.

Thx in advance for any reply.