Changing the database type is very unlikely to help, as HA has been tweaked to work the best with the default.
You are MUCH better off moving that data to a separate database like influxDB or something. Then the HA database can be nimble and be fast with what you need it for, collecting and automations.