-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
audit-logs: Add index to RealmAuditLog for realm and event type.
Adds an index on RealmAuditLog for the realm, event_type, and event_time in order to improve database queries on these audit logs. tabbott verified using EXPLAIN ANALYZE that this also considerably speeds up queries that order by ID rather than event_time, but event_time is how these should be ordered given the possibility of backfills.
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
zerver/migrations/0510_add_realmauditlog_realm_event_type_index.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.2.12 on 2024-04-17 10:33 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("zerver", "0509_fix_emoji_metadata"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddIndex( | ||
model_name="realmauditlog", | ||
index=models.Index( | ||
fields=["realm", "event_type", "event_time"], | ||
name="zerver_realmauditlog_realm__event_type__event_time", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters