Added an index for (doc, type) on DocEvent to speed up latest_event() queries.

- Legacy-Id: 14990
This commit is contained in:
Henrik Levkowetz 2018-04-01 19:33:16 +00:00
parent 4da044e2db
commit 43a9291053
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-01 12:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('doc', '0002_auto_20180220_1052'),
]
operations = [
migrations.AddIndex(
model_name='docevent',
index=models.Index(fields=[b'type', b'doc'], name='doc_doceven_type_43e53e_idx'),
),
]

View file

@ -1000,6 +1000,9 @@ class DocEvent(models.Model):
class Meta:
ordering = ['-time', '-id']
indexes = [
models.Index(fields=['type', 'doc']),
]
class NewRevisionDocEvent(DocEvent):
pass