Verbesserung: DB-Performance – Index auf voice_sessions(user_id, created_at) fehlt #17
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Performance / Verbesserung
Beschreibung
Die
voice_sessions-Tabelle wird in allen Queries nachuser_idundcreated_atgefiltert:Ohne Index werden bei diesen Queries immer alle Zeilen gescannt (Full Table Scan). Mit wachsender DB wird das zunehmend langsamer.
Fix
In
InitDB()Indizes anlegen:Vorteil
GetUserStats()wird deutlich schneller (Lookup per Index statt Full Scan)GetTopUsers()profitiert ebenfalls beim Filtern nachcreated_atCleanupOldEntries()löscht effizienter