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

Ensure database indexes are created for all generic foreign keys #11790

Closed
jeremystretch opened this issue Feb 20, 2023 · 0 comments
Closed

Ensure database indexes are created for all generic foreign keys #11790

jeremystretch opened this issue Feb 20, 2023 · 0 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user
Milestone

Comments

@jeremystretch
Copy link
Member

Proposed Changes

Audit all NetBox models and ensure that appropriate PostgreSQL indexes have been created for the combination of content type and object ID wherever generic foreign keys are in use.

Justification

This was prompted by #11775, which identified the absence of an index for cached search values as a performance detractor. Per the Django docs:

Unlike for the ForeignKey, a database index is not automatically created on the GenericForeignKey, so it’s recommended that you use Meta.indexes to add your own multiple column index.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user labels Feb 20, 2023
@jeremystretch jeremystretch self-assigned this Mar 17, 2023
@jeremystretch jeremystretch added this to the v3.5 milestone Mar 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user
Projects
None yet
Development

No branches or pull requests

1 participant