Skip to content

Add index project_id, component_version_id and id on sbom_occurrences

What does this MR do and why?

Add index project_id, component_version_id and id on sbom_occurrences.

EE: true Changelog: added

Require by this change: Replaces sbom_component_id by sbom_component_ve... (!141129 - closed) • Zamir Martins • 16.9

Related issue: #424205 (closed)

DB migrate

main: == [advisory_lock_connection] object_id: 182820, pg_backend_pid: 22751
main: == 20240109165047 AddIndexProjectIdComponentVersionIdIdOnSbomOccurrences: migrating
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0113s
main: -- index_exists?(:sbom_occurrences, [:project_id, :component_version_id, :id], {:name=>"index_sbom_occurr_on_project_id_and_component_version_id_and_id", :algorithm=>:concurrently})
main:    -> 0.0044s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- add_index(:sbom_occurrences, [:project_id, :component_version_id, :id], {:name=>"index_sbom_occurr_on_project_id_and_component_version_id_and_id", :algorithm=>:concurrently})
main:    -> 0.0090s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20240109165047 AddIndexProjectIdComponentVersionIdIdOnSbomOccurrences: migrated (0.0372s)

main: == [advisory_lock_connection] object_id: 182820, pg_backend_pid: 22751
ci: == [advisory_lock_connection] object_id: 183240, pg_backend_pid: 22753
ci: == 20240109165047 AddIndexProjectIdComponentVersionIdIdOnSbomOccurrences: migrating
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0005s
ci: -- index_exists?(:sbom_occurrences, [:project_id, :component_version_id, :id], {:name=>"index_sbom_occurr_on_project_id_and_component_version_id_and_id", :algorithm=>:concurrently})
ci:    -> 0.0083s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0002s
ci: -- add_index(:sbom_occurrences, [:project_id, :component_version_id, :id], {:name=>"index_sbom_occurr_on_project_id_and_component_version_id_and_id", :algorithm=>:concurrently})
ci:    -> 0.0053s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: == 20240109165047 AddIndexProjectIdComponentVersionIdIdOnSbomOccurrences: migrated (0.0273s)

$ bundle exec rails db:migrate:down:main VERSION=20240109165047
main: == [advisory_lock_connection] object_id: 182520, pg_backend_pid: 23280
main: == 20240109165047 AddIndexProjectIdComponentVersionIdIdOnSbomOccurrences: reverting
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0133s
main: -- indexes(:sbom_occurrence)
main:    -> 0.0012s
main: -- current_schema(nil)
main:    -> 0.0003s
main: == 20240109165047 AddIndexProjectIdComponentVersionIdIdOnSbomOccurrences: reverted (0.0227s)

main: == [advisory_lock_connection] object_id: 182520, pg_backend_pid: 23280

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Zamir Martins

Merge request reports