Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove indexes that aren't used and that are large #11623

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ericholscher
Copy link
Member

I ran some queries in prod to see what indexes weren't being used sorted by size.
These are the biggest ones without many queries hitting them.

Required updating django-simple-history to get the no_db_index.

I ran some queries in prod to see what indexes weren't being used sorted by size.
These are the biggest ones without many queries hitting them.

Required updating django-simple-history to get the no_db_index.
@ericholscher ericholscher requested a review from a team as a code owner September 26, 2024 16:03
@ericholscher ericholscher added the Priority: low Low priority label Sep 26, 2024
@ericholscher ericholscher marked this pull request as draft September 26, 2024 16:13
@ericholscher
Copy link
Member Author

Mostly putting this here so I don't lose it, not a huge priority, and will need a bit more testing to ship it.

@humitos
Copy link
Member

humitos commented Nov 26, 2024

It would be good to make the last step here to finish and deploy this PR.

@ericholscher ericholscher marked this pull request as ready for review February 18, 2025 21:37
@ericholscher
Copy link
Member Author

Should be ready to review 👍

Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. My only concern is about SSO here.

@@ -171,7 +171,7 @@ class RemoteRepository(TimeStampedModel):
blank=True,
)
# VCS provider repository id
remote_id = models.CharField(db_index=True, max_length=128)
remote_id = models.CharField(max_length=128)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, this called my attention. I think we perform a few queries based on remote_id in .com because of SSO. Have you checked this index there?

@@ -66,13 +66,11 @@ class ExtraFieldsHistoricalModel(models.Model):
_("ID"),
blank=True,
null=True,
db_index=True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use the help from @stsewd here. I don't know where these extra fields are used, and if the usage is intense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we use this models directly in our application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: low Low priority
Projects
Status: Needs review
Development

Successfully merging this pull request may close these issues.

3 participants