From 43a9291053df44f096d42067a0045a309d8960ba Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sun, 1 Apr 2018 19:33:16 +0000 Subject: [PATCH] Added an index for (doc, type) on DocEvent to speed up latest_event() queries. - Legacy-Id: 14990 --- .../doc/migrations/0003_auto_20180401_1231.py | 19 +++++++++++++++++++ ietf/doc/models.py | 3 +++ 2 files changed, 22 insertions(+) create mode 100644 ietf/doc/migrations/0003_auto_20180401_1231.py diff --git a/ietf/doc/migrations/0003_auto_20180401_1231.py b/ietf/doc/migrations/0003_auto_20180401_1231.py new file mode 100644 index 000000000..f277b40df --- /dev/null +++ b/ietf/doc/migrations/0003_auto_20180401_1231.py @@ -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'), + ), + ] diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 736c5717f..0191341e5 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -1000,6 +1000,9 @@ class DocEvent(models.Model): class Meta: ordering = ['-time', '-id'] + indexes = [ + models.Index(fields=['type', 'doc']), + ] class NewRevisionDocEvent(DocEvent): pass