Automatic epoch switcher
Certain plugins get incremental updates of sets of addresses (flows for its filters and fwup). To limit the size of the history we keep we have epochs ‒ an epoch starts with no history and with an initial snapshot. However, starting a new epoch is manual job now.
So instead of looking if the queries take too long and migrating all the current addresses to a new epoch manually, write a script that'd decide if a new epoch should be started (either after some fixed amount of time ‒ probably every quarter of year or so, or after the history grows too much) and if so, it would do the switch.
Also, it was noticed that if there are two or more epochs in the DB, the queries tend to be really slow. Either find out why or make sure there aren't two epochs at once (eg. by changing everything in a transaction and removing the old epoch).