mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Add indexes on fields on which we order and vice versa
Triggered by issue_event_list being more than 5s on "emu" (my 1,500,000 event test-machine). Reason: sorting those events on non-indexed field. Switching to a field-with-index solved it. I then analysed (grepped) for "ordering" and "order_by" and set indexes accordingly and more or less indiscriminately (i.e. even on tables that are assumed to have relatively few rows, such as Project & Team).
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 4.2.18 on 2025-02-04 20:14
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("snappea", "0003_task_created_at"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name="task",
|
||||
index=models.Index(
|
||||
fields=["created_at"], name="snappea_tas_created_eb0824_idx"
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -15,6 +15,11 @@ class Task(models.Model):
|
||||
def __str__(self):
|
||||
return self.task_name
|
||||
|
||||
class Meta:
|
||||
indexes = [
|
||||
models.Index(fields=['created_at']),
|
||||
]
|
||||
|
||||
|
||||
def wakeup_server():
|
||||
wakeup_file = os.path.join(get_settings().WAKEUP_CALLS_DIR, thread_uuid)
|
||||
|
||||
Reference in New Issue
Block a user