-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Index all generic foreign keys to improve query performance
It is generally recommended that relationship fields should be indexed. It is considered a misfeature that Django's GFKs do not created indexes by default. For example, see the discussion at: https://code.djangoproject.com/ticket/23435 To avoid this performance pitfall, add the necessary indexes.
- Loading branch information
Showing
3 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('contenttypes', '0002_remove_content_type_name'), | ||
('schedule', '0007_merge_text_fields'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='calendarrelation', | ||
name='object_id', | ||
field=models.IntegerField(db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name='eventrelation', | ||
name='object_id', | ||
field=models.IntegerField(db_index=True), | ||
), | ||
migrations.AlterIndexTogether( | ||
name='calendarrelation', | ||
index_together={('content_type', 'object_id')}, | ||
), | ||
migrations.AlterIndexTogether( | ||
name='eventrelation', | ||
index_together={('content_type', 'object_id')}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters