Add synchronous index on vulnerability_identifiers CVE names

What does this MR do and why?

Adds a post-deploy migration to create index_vulnerability_identifiers_on_name_where_cve synchronously on vulnerability_identifiers(name), matching the definition already prepared asynchronously in !250900 (merged).

The async index was introduced to fix cache-miss CPU spikes on the Sec production Patroni cluster caused by unindexed CVE-name lookups on vulnerability_identifiers. See #617135 (closed) for the investigation and query plans.

CREATE INDEX CONCURRENTLY index_vulnerability_identifiers_on_name_where_cve
ON vulnerability_identifiers USING btree (name)
WHERE (lower((external_type)::text) = 'cve');

Closes #617830 (closed)

Database

Migration up/down tested locally:

== 20260901093822 AddIndexVulnerabilityIdentifiersOnNameWhereCve: migrating ===
-- add_index(:vulnerability_identifiers, :name, {:name=>:index_vulnerability_identifiers_on_name_where_cve, :where=>"lower(external_type::text) = 'cve'", :algorithm=>:concurrently})
   -> 0.0250s
== 20260901093822 AddIndexVulnerabilityIdentifiersOnNameWhereCve: migrated (0.2332s)

Down migration reverted cleanly.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading