Add index on succeeded tasks (#164)

* Add index on task table

* also add models file

* add make commands and limit index

* format
This commit is contained in:
Stan Triepels
2024-09-08 03:37:28 +02:00
committed by GitHub
parent 2191897825
commit 69e794f1af
3 changed files with 37 additions and 0 deletions
+8
View File
@@ -5,6 +5,7 @@ from keyword import iskeyword
from django import get_version
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
from django.template.defaultfilters import truncatechars
from django.urls import reverse
from django.utils import timezone
@@ -111,6 +112,13 @@ class Task(models.Model):
class Meta:
app_label = "django_q"
ordering = ["-stopped"]
indexes = [
models.Index(
name="success_index",
fields=["group", "name", "func"],
condition=Q(success=True),
),
]
class SuccessManager(models.Manager):