Commit 8b781a35 authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak Committed by Mikołaj Wawrzyniak

Add index to events table support UMAU metric

One of the UMAU supporting metrics from Service Ping payalod
started to fail, due to timeout starting point batching query based on
created_at and id attribute. In order to fix this metric new index is
needed on events table.

Changelog: performance
parent 2997190b
# frozen_string_literal: true
class AddAsyncIndexOnEventsUsingBtreeCreatedAtId < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_events_on_created_at_and_id'
TABLE = :events
COLUMNS = %i[created_at id]
CONSTRAINTS = "created_at > '2021-08-27'"
def up
prepare_async_index TABLE, COLUMNS, name: INDEX_NAME, where: CONSTRAINTS
end
def down
unprepare_async_index TABLE, COLUMNS, name: INDEX_NAME, where: CONSTRAINTS
end
end
d7655fb2a01e389f59990b395ed7ef683b21a3371b7e68d3eb29def85eea1888
\ No newline at end of file
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