Skip to content

Index vulnerability_reads on casted_cluster_agent_id

Tiger Watson requested to merge add-vulnerability-reads-agent-id-index into master

What does this MR do and why?

Adds an index to vulnerability_reads.casted_cluster_agent_id. Currently there is only a partial index on this column, which is not suitable for performing foreign key actions.

Migration output

main: == 20220630050050 IndexVulnerabilityReadsOnCastedClusterAgentIdFull: migrating
main: -- transaction_open?()
main:    -> 0.0000s
main: -- index_exists?(:vulnerability_reads, :casted_cluster_agent_id, {:name=>"index_vuln_reads_on_casted_cluster_agent_id_where_it_is_null", :where=>"casted_cluster_agent_id IS NOT NULL", :algorithm=>:concurrently})
main:    -> 0.0100s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0006s
main: -- add_index(:vulnerability_reads, :casted_cluster_agent_id, {:name=>"index_vuln_reads_on_casted_cluster_agent_id_where_it_is_null", :where=>"casted_cluster_agent_id IS NOT NULL", :algorithm=>:concurrently})
main:    -> 0.0037s
main: -- execute("RESET statement_timeout")
main:    -> 0.0007s
main: == 20220630050050 IndexVulnerabilityReadsOnCastedClusterAgentIdFull: migrated (0.0235s)
main: == 20220630050050 IndexVulnerabilityReadsOnCastedClusterAgentIdFull: reverting
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:vulnerability_reads)
main:    -> 0.0122s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- remove_index(:vulnerability_reads, {:algorithm=>:concurrently, :name=>"index_vuln_reads_on_casted_cluster_agent_id_where_it_is_null"})
main:    -> 0.0026s
main: -- execute("RESET statement_timeout")
main:    -> 0.0005s
main: == 20220630050050 IndexVulnerabilityReadsOnCastedClusterAgentIdFull: reverted (0.0279s)

How to set up and validate locally

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

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

#366615 (closed)

Edited by João Alexandre Cunha

Merge request reports

Loading