Skip to content

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

@jeremystretch

Description

@jeremystretch

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.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: housekeepingChanges to the application which do not directly impact the end user

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions