From e406cfc9076d7d760022d995a22a04e4091e2e63 Mon Sep 17 00:00:00 2001 From: Toby Privett Date: Wed, 13 Nov 2024 16:40:57 +0000 Subject: [PATCH] Index profiles#person_id to improve SAR performance (#2403) --- db/migrate/20241113160043_add_index_to_person_id.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20241113160043_add_index_to_person_id.rb diff --git a/db/migrate/20241113160043_add_index_to_person_id.rb b/db/migrate/20241113160043_add_index_to_person_id.rb new file mode 100644 index 000000000..412d79771 --- /dev/null +++ b/db/migrate/20241113160043_add_index_to_person_id.rb @@ -0,0 +1,5 @@ +class AddIndexToPersonId < ActiveRecord::Migration[7.1] + def change + add_index :profiles, :person_id + end +end diff --git a/db/schema.rb b/db/schema.rb index b1745357f..2826d0469 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[7.1].define(version: 2024_05_02_112955) do +ActiveRecord::Schema[7.1].define(version: 2024_11_13_160043) do # These are extensions that must be enabled in order to support this database enable_extension "citext" enable_extension "pgcrypto" @@ -607,6 +607,7 @@ t.string "csra" t.index ["category_code"], name: "index_profiles_on_category_code" t.index ["category_id"], name: "index_profiles_on_category_id" + t.index ["person_id"], name: "index_profiles_on_person_id" t.index ["updated_at"], name: "index_profiles_on_updated_at" end