Home Assistant Swap Space Issue

Hi,

I have a Home Assistant running on RPi 3b+ with a 32GB microsd card, and its been running fine.
Recently, I have seen that swap space is getting very less, and in fact a few days back it went to 0…!!

I realised that the home assistant database was nearly 9GB, so I tried to purge it via the service call, but that didnt help so I deleted it and restarted the HA.

It did help, but again I can see the swap space is going down (see attached screenshot).

I know this is because I am logging history lots of devices, and after reading posts I realise one way is to reduce the number of devices I log history for.

What I wanted to ask is what other options do I have, if I do not want to reduce the number of devices I am logging. In fact I am adding more devices with time so it might increase as well.

Would switching to a SSD (let’s say 120GB) via USB help? Or is this problem going to keep coming because RPi 3B+ is just doesn’t have enough ram? Should I switch to a more powerful NUC, or will a RPI 4 help, or will that too have the same issue?

Any help, suggestions?

Thanks.brave_2020-06-23_10-13-04