Files
gandalf/schema.sql
Jared Vititoe 8f852ed830 Add compound DB indexes for hot query paths
network_events: idx_event_lookup (event_type, target_name, target_detail, resolved_at)
  - Covers the upsert_event SELECT which runs every cycle per monitored entity
  - Replaces three separate single-column index scans with one covering lookup

suppression_rules: idx_sup_lookup (active, target_type, target_name, target_detail)
  - Covers is_suppressed() queries (now redundant for runtime due to in-memory
    check_suppressed, but ensures fast get_active_suppressions() loading per cycle)

Both indexes created on live DB (MariaDB LXC 149).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 14:24:40 -04:00

2.6 KiB