chore: Additional indexes and fixes (#6675)
- Fix breakage related to the look-up job in Heroku deploys - Add additional db indexes for performance optimisations
This commit is contained in:
11
db/migrate/20230315105847_add_indexes_for_common_queries.rb
Normal file
11
db/migrate/20230315105847_add_indexes_for_common_queries.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class AddIndexesForCommonQueries < ActiveRecord::Migration[6.1]
|
||||
# disabling ddl transaction is required for concurrent index creation
|
||||
# https://thoughtbot.com/blog/how-to-create-postgres-indexes-concurrently-in
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
ActiveRecord::Migration[6.1].add_index(:inboxes, [:channel_id, :channel_type], algorithm: :concurrently)
|
||||
ActiveRecord::Migration[6.1].add_index(:conversations, [:account_id, :inbox_id, :status, :assignee_id], name: 'conv_acid_inbid_stat_asgnid_idx',
|
||||
algorithm: :concurrently)
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2023_03_13_113920) do
|
||||
ActiveRecord::Schema.define(version: 2023_03_15_105847) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
@@ -448,6 +448,7 @@ ActiveRecord::Schema.define(version: 2023_03_13_113920) do
|
||||
t.datetime "assignee_last_seen_at"
|
||||
t.datetime "first_reply_created_at"
|
||||
t.index ["account_id", "display_id"], name: "index_conversations_on_account_id_and_display_id", unique: true
|
||||
t.index ["account_id", "inbox_id", "status", "assignee_id"], name: "conv_acid_inbid_stat_asgnid_idx"
|
||||
t.index ["account_id"], name: "index_conversations_on_account_id"
|
||||
t.index ["assignee_id", "account_id"], name: "index_conversations_on_assignee_id_and_account_id"
|
||||
t.index ["campaign_id"], name: "index_conversations_on_campaign_id"
|
||||
@@ -576,6 +577,7 @@ ActiveRecord::Schema.define(version: 2023_03_13_113920) do
|
||||
t.jsonb "auto_assignment_config", default: {}
|
||||
t.boolean "lock_to_single_conversation", default: false, null: false
|
||||
t.index ["account_id"], name: "index_inboxes_on_account_id"
|
||||
t.index ["channel_id", "channel_type"], name: "index_inboxes_on_channel_id_and_channel_type"
|
||||
end
|
||||
|
||||
create_table "installation_configs", force: :cascade do |t|
|
||||
|
||||
Reference in New Issue
Block a user