Files
beacon-server/db/migrations/013_packets_scope_index.sql
T
MrAlders0n 42edcdeb7b perf(scopes): stop cross-joining packets in scope stats
GetScopeStats left-joined packets, observer_scopes and nodes at once,
multiplying rows into the millions before COUNT(DISTINCT) deduped them
(~10s per call). Count each table on its own and index packets(scope_id).
2026-07-24 12:07:05 -07:00

4 lines
136 B
SQL

-- Scope stats count off scope_id, which had no index.
CREATE INDEX idx_packets_scope ON packets(scope_id) WHERE scope_id IS NOT NULL;