Replace one INSERT per event (up to FETCH_LIMIT auto-committed
round trips per node per poll) with multi-row INSERTs in chunks of
200, wrapped in a single transaction per node. Same data, one
commit instead of hundreds, which was making fetch runs slower as
the table grew.
Time-window queries (dashboard stats, recent connections, JSON API,
purge) had no usable index and full-scanned the connections table on
every load, so the dashboard slowed down as data accumulated.
- Add idx_occurred (occurred_at) for counts, MAX, ORDER BY ... LIMIT,
and the purge delete
- Add idx_src_ip_occ (src_ip, occurred_at) so frequent_ips() runs as a
covering index scan
- Drop the now-redundant standalone idx_src_ip
Migrations in setup.php are idempotent (information_schema checks) and
portable across MySQL 8 and MariaDB.