Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Add missing indices
Browse files Browse the repository at this point in the history
It should potentially improve performance of some queries a bit.
No benchmarking is done, just those fields are used in various queries.

closes #6742
https://pulp.plan.io/issues/6742
  • Loading branch information
goosemania committed Apr 7, 2021
1 parent 59e4f38 commit e689a45
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/6742.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added some indices used in various queries.
46 changes: 46 additions & 0 deletions pulp_2to3_migration/app/migrations/0028_create_missing_indices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Generated by Django 2.2.19 on 2021-03-30 17:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('pulp_2to3_migration', '0027_pulp2repocontent_created_index'),
]

operations = [
migrations.AddIndex(
model_name='pulp2content',
index=models.Index(fields=['pulp2_last_updated'], name='pulp_2to3_m_pulp2_l_c8b0d6_idx'),
),
migrations.AddIndex(
model_name='pulp2distributor',
index=models.Index(fields=['pulp2_last_updated'], name='pulp_2to3_m_pulp2_l_2c5996_idx'),
),
migrations.AddIndex(
model_name='pulp2distributor',
index=models.Index(fields=['pulp2_repo_id'], name='pulp_2to3_m_pulp2_r_77bd32_idx'),
),
migrations.AddIndex(
model_name='pulp2importer',
index=models.Index(fields=['pulp2_last_updated'], name='pulp_2to3_m_pulp2_l_2bbfde_idx'),
),
migrations.AddIndex(
model_name='pulp2repository',
index=models.Index(fields=['pulp2_last_unit_added'], name='pulp_2to3_m_pulp2_l_270629_idx'),
),
migrations.AddIndex(
model_name='pulp2repository',
index=models.Index(fields=['pulp2_last_unit_removed'], name='pulp_2to3_m_pulp2_l_2de33d_idx'),
),
migrations.AddIndex(
model_name='pulp2repository',
index=models.Index(fields=['pulp2_repo_id'], name='pulp_2to3_m_pulp2_r_68b419_idx'),
),
migrations.AddIndex(
model_name='pulp2importer',
index=models.Index(fields=['pulp2_repo_id'], name='pulp_2to3_m_pulp2_r_46adaf_idx'),
),

]
1 change: 1 addition & 0 deletions pulp_2to3_migration/app/models/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Meta:
]
indexes = [
models.Index(fields=['pulp2_content_type_id']),
models.Index(fields=['pulp2_last_updated']),
]


Expand Down
7 changes: 7 additions & 0 deletions pulp_2to3_migration/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Pulp2Repository(BaseModel):
class Meta:
indexes = [
models.Index(fields=['pulp2_repo_type']),
models.Index(fields=['pulp2_last_unit_added']),
models.Index(fields=['pulp2_last_unit_removed']),
models.Index(fields=['pulp2_repo_id']),
]


Expand Down Expand Up @@ -128,6 +131,8 @@ class Pulp2Importer(BaseModel):
class Meta:
indexes = [
models.Index(fields=['pulp2_type_id']),
models.Index(fields=['pulp2_last_updated']),
models.Index(fields=['pulp2_repo_id']),
]


Expand Down Expand Up @@ -178,4 +183,6 @@ class Meta:
unique_together = ('pulp2_object_id',)
indexes = [
models.Index(fields=['pulp2_type_id']),
models.Index(fields=['pulp2_last_updated']),
models.Index(fields=['pulp2_repo_id']),
]

0 comments on commit e689a45

Please sign in to comment.