added ability to check shared devices

This commit is contained in:
onysd 2026-08-06 02:12:46 +03:00
parent 7d0daef923
commit 72db66d4aa
14 changed files with 456 additions and 23 deletions

View file

@ -0,0 +1 @@
DROP INDEX IF EXISTS idx_authorizations_device_fingerprint;

View file

@ -0,0 +1,10 @@
-- Supports the admin console's "accounts sharing a device" report, which
-- groups authorizations by (device_model, system_version, platform, ip) and
-- looks for groups spanning more than one distinct user_id. Without this
-- index that GROUP BY is a full sequential scan of authorizations, a table
-- that grows roughly with active-session count and is never pruned except on
-- explicit revoke.
CREATE INDEX idx_authorizations_device_fingerprint
ON public.authorizations (device_model, system_version, platform, ip)
WHERE device_model <> '';