Additional indexes (#321)

This commit is contained in:
Max Wofford
2025-06-16 15:26:38 -04:00
committed by GitHub
parent 94431c0d09
commit 9247f19cbb
3 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
class AddIndexToGoodJobsFinishedAtWithError < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index :good_jobs, :finished_at,
where: 'error IS NOT NULL',
algorithm: :concurrently,
name: 'index_good_jobs_finished_at_with_error'
end
end

View File

@@ -0,0 +1,10 @@
class AddIndexToAhoyVisitsStartedAtWithReferringDomain < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index :ahoy_visits, :started_at,
where: 'referring_domain IS NOT NULL',
algorithm: :concurrently,
name: 'index_ahoy_visits_started_at_with_referring_domain'
end
end

4
db/schema.rb generated
View File

@@ -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_06_13_163710) do
ActiveRecord::Schema[8.0].define(version: 2025_06_16_192214) do
create_schema "pganalyze"
# These are extensions that must be enabled in order to support this database
@@ -57,6 +57,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_13_163710) do
t.string "platform"
t.datetime "started_at"
t.index ["started_at"], name: "index_ahoy_visits_on_started_at"
t.index ["started_at"], name: "index_ahoy_visits_started_at_with_referring_domain", where: "(referring_domain IS NOT NULL)"
t.index ["user_id"], name: "index_ahoy_visits_on_user_id"
t.index ["visit_token"], name: "index_ahoy_visits_on_visit_token", unique: true
t.index ["visitor_token", "started_at"], name: "index_ahoy_visits_on_visitor_token_and_started_at"
@@ -202,6 +203,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_13_163710) do
t.index ["concurrency_key"], name: "index_good_jobs_on_concurrency_key_when_unfinished", where: "(finished_at IS NULL)"
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_finished_at_with_error", where: "(error 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 ["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)"