Adding extra index to improve slow queries speed
parent
8f1f001872
commit
3dccb9e90e
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.6 on 2017-04-06 06:15
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
|
('timeline', '0006_json_to_jsonb'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterIndexTogether(
|
||||||
|
name='timeline',
|
||||||
|
index_together=set([('content_type', 'object_id', 'namespace'), ('namespace', 'created')]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -38,7 +38,8 @@ class Timeline(models.Model):
|
||||||
created = models.DateTimeField(default=timezone.now, db_index=True)
|
created = models.DateTimeField(default=timezone.now, db_index=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
index_together = [('content_type', 'object_id', 'namespace'), ]
|
index_together = [('content_type', 'object_id', 'namespace'),
|
||||||
|
('namespace', 'created'),]
|
||||||
|
|
||||||
# Register all implementations
|
# Register all implementations
|
||||||
from .timeline_implementations import *
|
from .timeline_implementations import *
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.6 on 2017-04-06 07:27
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('users', '0023_json_to_jsonb'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunSQL("CREATE INDEX ON users_user (UPPER('username'))"),
|
||||||
|
migrations.RunSQL("CREATE INDEX ON users_user (UPPER('email'))"),
|
||||||
|
]
|
Loading…
Reference in New Issue