index_vulnerability_identifiers_on_name_where_cve synchronous database index addition
Summary
This issue is to add a migration to create the index_vulnerability_identifiers_on_name_where_cve database index synchronously after it has been created asynchronously on GitLab.com.
The asynchronous 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');Steps
- Verify the async index was created on GitLab.com (ChatOps:
/chatops gitlab run auto_deploy status <merge_sha>should returndb/gprd, or querypostgres_async_indexes/pg_indexesdirectly). - Add a post-deploy migration that calls
add_concurrent_indexfor the same index (prepare_async_indexalready records the definition; the sync migration must match it exactly) and remove it frompostgres_async_indexes.
Edited by 🤖 GitLab Bot 🤖