Enhanced Recorder Filtering - Exclude States (e.g., 'unknown', 'unavailable')

Then you should fix your set up so this does not happen. You will have a more reliable system and your DB will be slightly smaller.

Also the unavailable states are required for the frontend graphs to represent your device history correctly.

Also if you are running HA OS I recommend you install the DbStats add-on so you can see what is really bloating your DB. It is unlikely to be just unavailable states.