Skip to content

Add index to improve contribution graph query

Heinrich Lee Yu requested to merge create-calendar-events-index-sync into master

What does this MR do and why?

Follow-up to !74970 (merged) to create the index synchronously and remove the old index.

The first migration is a no-op on GitLab.com because it has already been created over the weekend.

Migration output

== 20211206073851 CreateCalendarEventsIndexSynchronously: migrating ===========
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:events, [:author_id, :project_id, :action, :target_type, :created_at], {:name=>"index_events_author_id_project_id_action_target_type_created_at", :algorithm=>:concurrently})
   -> 0.0147s
-- Index not created because it already exists (this may be due to an aborted migration or similar): table_name: events, column_name: [:author_id, :project_id, :action, :target_type, :created_at]
== 20211206073851 CreateCalendarEventsIndexSynchronously: migrated (0.0174s) ==

== 20211206074547 RemoveOldCalendarEventsIndex: migrating =====================
-- transaction_open?()
   -> 0.0000s
-- indexes(:events)
   -> 0.0065s
-- current_schema()
   -> 0.0003s
== 20211206074547 RemoveOldCalendarEventsIndex: migrated (0.0112s) ============

== 20211206074547 RemoveOldCalendarEventsIndex: reverting =====================
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:events, [:author_id, :project_id], {:name=>"index_events_on_author_id_and_project_id", :algorithm=>:concurrently})
   -> 0.0080s
-- add_index(:events, [:author_id, :project_id], {:name=>"index_events_on_author_id_and_project_id", :algorithm=>:concurrently})
   -> 0.0177s
== 20211206074547 RemoveOldCalendarEventsIndex: reverted (0.0289s) ============

== 20211206073851 CreateCalendarEventsIndexSynchronously: reverting ===========
-- transaction_open?()
   -> 0.0000s
-- indexes(:events)
   -> 0.0080s
-- remove_index(:events, {:algorithm=>:concurrently, :name=>"index_events_author_id_project_id_action_target_type_created_at"})
   -> 0.0090s
== 20211206073851 CreateCalendarEventsIndexSynchronously: reverted (0.0277s) ==

MR acceptance checklist

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

Edited by Heinrich Lee Yu

Merge request reports