Add case-insensitive expression index on Vulnerability_Id.vulnerability_id#15218
Draft
devGregA wants to merge 1 commit into
Draft
Add case-insensitive expression index on Vulnerability_Id.vulnerability_id#15218devGregA wants to merge 1 commit into
devGregA wants to merge 1 commit into
Conversation
…ty_id Index UPPER(vulnerability_id), finding_id on dojo_vulnerability_id so CVE-keyed lookups (enrichment, exploit/threat-intel matching, dedupe helpers) stop sequentially scanning the table; scanner-supplied ids are not case-normalized, so the index and any query both fold with UPPER(). finding_id is included so changed-CVE -> finding fan-out is an index-only scan. Built CONCURRENTLY IF NOT EXISTS (non-atomic migration) via SeparateDatabaseAndState so it does not lock the table on large instances and is idempotent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a case-insensitive expression index on
Vulnerability_Id.vulnerability_idAdds an index on
UPPER(vulnerability_id), finding_idtodojo_vulnerability_id.Why
Vulnerability-id → finding lookups (CVE-keyed enrichment, exploit/threat-intel matching, dedupe helpers) currently sequentially scan
dojo_vulnerability_id— the string column has no index today, and scanner-supplied ids aren't case-normalized, so any correct lookup must fold withUPPER(). This adds the matching functional index; includingfinding_idmakes the changed-CVE → finding fan-out an index-only scan.What
Vulnerability_Id.Meta.indexesgainsIndex(Upper("vulnerability_id"), "finding", name="dojo_vulnid_upper_idx").0278builds itCREATE INDEX CONCURRENTLY IF NOT EXISTS(non-atomic) so it doesn't lock the table on large instances, withSeparateDatabaseAndStatekeeping Django's model state in sync.IF NOT EXISTSmakes it idempotent and safe to co-exist with any downstream migration that created the same-named index first.Notes
🤖 Generated with Claude Code