This partly addresses #3115 by adding indexes (non-unique because duplicate data is present) and optimises the queries used by the billing module poller. These changes improved the performance drastically on our installation - the billing poller previously was taking significantly over 5 minutes to run without them, and 40 seconds with these changes.
Please note, adding the indexes can take some time on systems with lots of billing history, so the DB update script might take a few minutes to run.
The unnecessary tables and duplicate data can be dealt with separately.
Improve performance of billing poller
Auto-Deploy finished, Test PR at http://3129.ci.librenms.org or https://3129.ci.librenms.org
Total of < 80 seconds with:
7.5m rows for port_in_measurements
7.5m rows for port_out_measurements
3.7m rows for bill_data
Webui and polling/disco unaffected during schema update just bill polling.