summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 12:07:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 12:07:18 +0000
commitfc0afaf7da2156e91e615662272811eee56d034a (patch)
treec6199a554acff7bdd34a7b6d7edf673807062212 /db
parente6b6fb602889e43e7a8dde760e01d0a3b2147c54 (diff)
downloadgitlab-ce-fc0afaf7da2156e91e615662272811eee56d034a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20221220075936_add_query_index_for_ci_pipeline_schedules.rb18
-rw-r--r--db/schema_migrations/202212200759361
-rw-r--r--db/structure.sql2
3 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20221220075936_add_query_index_for_ci_pipeline_schedules.rb b/db/post_migrate/20221220075936_add_query_index_for_ci_pipeline_schedules.rb
new file mode 100644
index 00000000000..4fc64f66a83
--- /dev/null
+++ b/db/post_migrate/20221220075936_add_query_index_for_ci_pipeline_schedules.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddQueryIndexForCiPipelineSchedules < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_pipeline_schedules
+ INDEX_NAME = :index_ci_pipeline_schedules_on_id_and_next_run_at_and_active
+ COLUMNS = %i[id next_run_at].freeze
+ INDEX_CONDITION = 'active = TRUE'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(TABLE_NAME, COLUMNS, name: INDEX_NAME, where: INDEX_CONDITION)
+ end
+
+ def down
+ remove_concurrent_index(TABLE_NAME, COLUMNS, name: INDEX_NAME)
+ end
+end
diff --git a/db/schema_migrations/20221220075936 b/db/schema_migrations/20221220075936
new file mode 100644
index 00000000000..194046d51e2
--- /dev/null
+++ b/db/schema_migrations/20221220075936
@@ -0,0 +1 @@
+43f0493091c58f1573613d5672a999bf07994ced2b7172a7aef9148f4d8b8dbe \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 7815d81562d..b4a9509ea5b 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -28907,6 +28907,8 @@ CREATE INDEX index_ci_pipeline_metadata_on_project_id ON ci_pipeline_metadata US
CREATE UNIQUE INDEX index_ci_pipeline_schedule_variables_on_schedule_id_and_key ON ci_pipeline_schedule_variables USING btree (pipeline_schedule_id, key);
+CREATE INDEX index_ci_pipeline_schedules_on_id_and_next_run_at_and_active ON ci_pipeline_schedules USING btree (id, next_run_at) WHERE (active = true);
+
CREATE INDEX index_ci_pipeline_schedules_on_next_run_at_and_active ON ci_pipeline_schedules USING btree (next_run_at, active);
CREATE INDEX index_ci_pipeline_schedules_on_owner_id ON ci_pipeline_schedules USING btree (owner_id);