-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add index on BaseTarget.created to speed up load time of large DBs
We currently sort on the created field of BaseTarget, which causes performance issues when there are a large number of BaseTargets. In a database with 6 million rows, this reduced the time for the SQL count(*) from ~800ms to ~100ms, significantly speeding up page load time. Note that this does NOT solve #598 but it does help a little.
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
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
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,18 @@ | ||
# Generated by Django 4.2.18 on 2025-02-05 21:53 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('tom_targets', '0022_persistentshare'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='basetarget', | ||
name='created', | ||
field=models.DateTimeField(auto_now_add=True, db_index=True, help_text='The time which this target was created in the TOM database.', verbose_name='Time Created'), | ||
), | ||
] |