diff --git a/Gemfile.lock b/Gemfile.lock index aa89bedef18..6a57c5f4229 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -355,7 +355,7 @@ GEM ffi (~> 1.0) globalid (1.2.1) activesupport (>= 6.1) - good_job (4.9.3) + good_job (4.12.0) activejob (>= 6.1.0) activerecord (>= 6.1.0) concurrent-ruby (>= 1.3.1) diff --git a/db/worker_jobs_migrate/20251006145302_add_index_good_jobs_job_class.rb b/db/worker_jobs_migrate/20251006145302_add_index_good_jobs_job_class.rb new file mode 100644 index 00000000000..0adc63e25af --- /dev/null +++ b/db/worker_jobs_migrate/20251006145302_add_index_good_jobs_job_class.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsJobClass < ActiveRecord::Migration[8.0] + disable_ddl_transaction! + + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.index_exists? :good_jobs, :job_class + end + end + + add_index :good_jobs, :job_class, algorithm: :concurrently + end +end \ No newline at end of file diff --git a/db/worker_jobs_schema.rb b/db/worker_jobs_schema.rb index a1328af8a6b..c5200efa51d 100644 --- a/db/worker_jobs_schema.rb +++ b/db/worker_jobs_schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_03_17_182751) do +ActiveRecord::Schema[8.0].define(version: 2025_10_06_145302) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" enable_extension "pgcrypto" @@ -96,6 +96,7 @@ t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at_cond", where: "(cron_key IS NOT NULL)" t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at_cond", unique: true, where: "(cron_key IS NOT NULL)" t.index ["finished_at"], name: "index_good_jobs_jobs_on_finished_at", where: "((retried_good_job_id IS NULL) AND (finished_at IS NOT NULL))" + t.index ["job_class"], name: "index_good_jobs_on_job_class" t.index ["labels"], name: "index_good_jobs_on_labels", where: "(labels IS NOT NULL)", using: :gin t.index ["locked_by_id"], name: "index_good_jobs_on_locked_by_id", where: "(locked_by_id IS NOT NULL)" t.index ["priority", "created_at"], name: "index_good_job_jobs_for_candidate_lookup", where: "(finished_at IS NULL)"