Commit a09fb11d authored by Michał Zając's avatar Michał Zając

Add an index on vulnerability_occurrence_pipelines

Create (occurrence_id, id DESC) index on
vulnerability_occurrence_pipelines to speed up a query commonly executed
on Vulnerability Report section

Changelog: performance
parent 880383fd
# frozen_string_literal: true
class AddOccurrenceIdIdDescIndexToVulnerabilityOccurrencePipelines < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
INDEX_NAME = "index_vulnerability_occurrence_pipelines_occurrence_id_and_id"
def up
add_concurrent_index(
:vulnerability_occurrence_pipelines,
[:occurrence_id, :id],
order: { id: :desc },
name: INDEX_NAME
)
end
def down
remove_concurrent_index_by_name(
:vulnerability_occurrence_pipelines,
INDEX_NAME
)
end
end
ed6939c1e89f78290c312bf005cb33bd1a5ee778e8d9be3ae2eb04cc25416b92
\ No newline at end of file
...@@ -27057,6 +27057,8 @@ CREATE INDEX index_vulnerability_occurrence_identifiers_on_identifier_id ON vuln ...@@ -27057,6 +27057,8 @@ CREATE INDEX index_vulnerability_occurrence_identifiers_on_identifier_id ON vuln
CREATE UNIQUE INDEX index_vulnerability_occurrence_identifiers_on_unique_keys ON vulnerability_occurrence_identifiers USING btree (occurrence_id, identifier_id); CREATE UNIQUE INDEX index_vulnerability_occurrence_identifiers_on_unique_keys ON vulnerability_occurrence_identifiers USING btree (occurrence_id, identifier_id);
CREATE INDEX index_vulnerability_occurrence_pipelines_occurrence_id_and_id ON vulnerability_occurrence_pipelines USING btree (occurrence_id, id DESC);
CREATE INDEX index_vulnerability_occurrence_pipelines_on_pipeline_id ON vulnerability_occurrence_pipelines USING btree (pipeline_id); CREATE INDEX index_vulnerability_occurrence_pipelines_on_pipeline_id ON vulnerability_occurrence_pipelines USING btree (pipeline_id);
CREATE INDEX index_vulnerability_occurrences_deduplication ON vulnerability_occurrences USING btree (project_id, report_type, project_fingerprint); CREATE INDEX index_vulnerability_occurrences_deduplication ON vulnerability_occurrences USING btree (project_id, report_type, project_fingerprint);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment