Duplicate database indexes #18188
-
I started using the feature 'Index Tuning' of the Azure PostgreSQL flexible server for the Netbox database. Netbox version is 3.7.1 and PostgreSQL version is 14.13. After 24 hours, it found 6 rcommendations, all of them to drop duplicate indexes:
Does anybody know if I can follow the Azure recommendations? Is it possible the Netbox database has duplicate indexes? If so, why? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Looking at the first instance, there are indeed two similar indexes:
I believe this is because we explicitly define an index for the generic foreign key (GFK) relation I haven't dug into the others but I suspect they all result from similar situations, and can probably be cleaned up. @acscampos would you mind submitting a housekeeping issue with this information? We can dig into it further when we have time. Thanks for the report! |
Beta Was this translation helpful? Give feedback.
Looking at the first instance, there are indeed two similar indexes:
I believe this is because we explicitly define an index for the generic foreign key (GFK) relation
termination
, which Django does not do automatically. Separately, we also declare a uniqueness constraint for this pair of fields, to ensure an object cannot have more than one termination. Hence the duplicate indexes. It should be safe to remove the former index.I haven't dug into the others but I suspect they all result from similar situations, and…