Follow-up from "Add VulnerabilityStateTransition model"
The following discussion from !87957 (merged) should be addressed:
-
@Quintasan started a discussion: (+3 comments) question to maintainer: If my Postgres foo is correct then I think that adding an index on
(vulnerability_id, created_at DESC)
would be beneficial here because:- Indexes on foreign keys are mandatory
- We will most likely want to present the state transition from the latest one to the first one (
ORDER BY created_at DESC
) - The same index would be used for queries like
SELECT * FROM vulnerability_state_transitions WHERE vulnerability_in (1,2,3,...,n);
That way we could drop
index: true
from the migration creating the table and would have one index left