diff --git a/changelogs/unreleased/323676-add-index-on-web-hook-id-to-partitioned-web-hook-logs.yml b/changelogs/unreleased/323676-add-index-on-web-hook-id-to-partitioned-web-hook-logs.yml new file mode 100644 index 0000000000000000000000000000000000000000..eb9b3dbf088bf384bc6a902bb78b829bfe24c041 --- /dev/null +++ b/changelogs/unreleased/323676-add-index-on-web-hook-id-to-partitioned-web-hook-logs.yml @@ -0,0 +1,5 @@ +--- +title: Add index on web_hook_id to partitioned web_hook_logs +merge_request: 59266 +author: +type: other diff --git a/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb b/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb new file mode 100644 index 0000000000000000000000000000000000000000..300c19d3e51fd6f9a65d92e74febcf21219fbd5e --- /dev/null +++ b/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexOnWebHookIdToPartitionedWebHookLog < ActiveRecord::Migration[6.0] + include Gitlab::Database::PartitioningMigrationHelpers + + DOWNTIME = false + + WEB_HOOK_ID_INDEX_NAME = 'index_web_hook_logs_part_on_web_hook_id' + + disable_ddl_transaction! + + def up + add_concurrent_partitioned_index :web_hook_logs_part_0c5294f417, + :web_hook_id, + name: WEB_HOOK_ID_INDEX_NAME + end + + def down + remove_concurrent_partitioned_index_by_name :web_hook_logs_part_0c5294f417, WEB_HOOK_ID_INDEX_NAME + end +end diff --git a/db/schema_migrations/20210413123832 b/db/schema_migrations/20210413123832 new file mode 100644 index 0000000000000000000000000000000000000000..4a8af15f336548923b66363bb00d260db740f7ef --- /dev/null +++ b/db/schema_migrations/20210413123832 @@ -0,0 +1 @@ +d166250305c2939bea8cc1970faf50d86776d32270a80a429cce668a97280aad \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 5d0ca31e91f58737cacb6ab9c2fcda9d4a709a2f..947f0e649e1107410a023a8b4151188dff2880a0 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -24258,6 +24258,8 @@ CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs USING btree (web_hook_id); +CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (web_hook_id); + CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHERE ((type)::text = 'GroupHook'::text); CREATE INDEX index_web_hooks_on_project_id ON web_hooks USING btree (project_id);