diff options
author | Dmitry Chepurovskiy <dm3ch@dm3ch.net> | 2019-05-20 15:03:34 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-05-20 15:03:34 +0000 |
commit | 7017889d0b92dd8bd215770a9d4f823b5dc1f2eb (patch) | |
tree | 0cbce8dda9e38e89632f7d59a0b774873ec8bae5 /db | |
parent | 7115bd811f4bc87c0706fc2b876729878ad8fc5b (diff) | |
download | gitlab-ce-7017889d0b92dd8bd215770a9d4f823b5dc1f2eb.tar.gz |
Added filtering jobs by age to jobs/request API endpoint
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190516011213_add_build_queued_at_index.rb | 19 | ||||
-rw-r--r-- | db/schema.rb | 3 |
2 files changed, 21 insertions, 1 deletions
diff --git a/db/migrate/20190516011213_add_build_queued_at_index.rb b/db/migrate/20190516011213_add_build_queued_at_index.rb new file mode 100644 index 00000000000..77ffa7cd4e9 --- /dev/null +++ b/db/migrate/20190516011213_add_build_queued_at_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# This migration make queued_at field indexed to speed up builds filtering by job_age + +class AddBuildQueuedAtIndex < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_builds, :queued_at + end + + def down + remove_concurrent_index :ci_builds, :queued_at + end +end diff --git a/db/schema.rb b/db/schema.rb index 9d367938cec..412b5313b69 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190515125613) do +ActiveRecord::Schema.define(version: 20190516011213) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -380,6 +380,7 @@ ActiveRecord::Schema.define(version: 20190515125613) do t.index ["project_id", "id"], name: "index_ci_builds_on_project_id_and_id", using: :btree t.index ["project_id", "status"], name: "index_ci_builds_project_id_and_status_for_live_jobs_partial2", where: "(((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])))", using: :btree t.index ["protected"], name: "index_ci_builds_on_protected", using: :btree + t.index ["queued_at"], name: "index_ci_builds_on_queued_at", using: :btree t.index ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree t.index ["scheduled_at"], name: "partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs", where: "((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text))", using: :btree t.index ["stage_id", "stage_idx"], name: "tmp_build_stage_position_index", where: "(stage_idx IS NOT NULL)", using: :btree |