DB indexes for the issue-lits (including filters)

simply by reasoning about what they should be; no performance testing (on the issue-list
and on the event-ingestion) was done for these)
This commit is contained in:
Klaas van Schelven
2025-02-18 10:32:06 +01:00
parent 2cb87f8334
commit 10f8e10607
2 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
# Generated by Django 4.2.19 on 2025-02-18 09:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("issues", "0009_fill_stored_event_count"),
]
operations = [
migrations.AddIndex(
model_name="issue",
index=models.Index(
fields=["is_resolved", "is_muted", "last_seen"],
name="issues_issu_is_reso_eaf32b_idx",
),
),
migrations.AddIndex(
model_name="issue",
index=models.Index(
fields=["is_muted", "last_seen"], name="issues_issu_is_mute_6fe7fc_idx"
),
),
migrations.AddIndex(
model_name="issue",
index=models.Index(
fields=["is_resolved", "last_seen"],
name="issues_issu_is_reso_0b6923_idx",
),
),
]

View File

@@ -118,6 +118,11 @@ class Issue(models.Model):
indexes = [
models.Index(fields=["first_seen"]),
models.Index(fields=["last_seen"]),
# 3 indexes for the list view (state_filter)
models.Index(fields=["is_resolved", "is_muted", "last_seen"]), # filter on resolved/muted
models.Index(fields=["is_muted", "last_seen"]), # filter on muted
models.Index(fields=["is_resolved", "last_seen"]), # filter on resolved
]