feat(perf): contacts query performance (#7175)

* feat: use more indexable where condition

* feat: add index concurrently

* chore: update schema

* refactor: update index name
This commit is contained in:
Shivam Mishra
2023-05-23 17:22:47 +05:30
committed by GitHub
parent 9c6c19c3e5
commit 44b1047b90
3 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
class AddPartialIndexForResolvedContacts < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_index :contacts, [:account_id, :email, :phone_number, :identifier], where: "(email <> '' OR phone_number <> '' OR identifier <> '')",
name: 'index_contacts_on_nonempty_fields', algorithm: :concurrently
end
end