-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
base: main
Are you sure you want to change the base?
Conversation
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.
Mostly putting this here so I don't lose it, not a huge priority, and will need a bit more testing to ship it. |
It would be good to make the last step here to finish and deploy this PR. |
…move-unused-indexes
Should be ready to review 👍 |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.