feat(perf): add index to messages created at (#7044)
* feat: add index to messages created at * feat: run migration
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
# index_messages_on_additional_attributes_campaign_id (((additional_attributes -> 'campaign_id'::text))) USING gin
|
# index_messages_on_additional_attributes_campaign_id (((additional_attributes -> 'campaign_id'::text))) USING gin
|
||||||
# index_messages_on_content (content) USING gin
|
# index_messages_on_content (content) USING gin
|
||||||
# index_messages_on_conversation_id (conversation_id)
|
# index_messages_on_conversation_id (conversation_id)
|
||||||
|
# index_messages_on_created_at (created_at)
|
||||||
# index_messages_on_inbox_id (inbox_id)
|
# index_messages_on_inbox_id (inbox_id)
|
||||||
# index_messages_on_sender_type_and_sender_id (sender_type,sender_id)
|
# index_messages_on_sender_type_and_sender_id (sender_type,sender_id)
|
||||||
# index_messages_on_source_id (source_id)
|
# index_messages_on_source_id (source_id)
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class AddIndexToMessagesCreatedAt < ActiveRecord::Migration[7.0]
|
||||||
|
disable_ddl_transaction!
|
||||||
|
def change
|
||||||
|
add_index :messages, [:created_at], name: 'index_messages_on_created_at', algorithm: :concurrently
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_04_26_130150) do
|
ActiveRecord::Schema[7.0].define(version: 2023_05_09_101256) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_stat_statements"
|
enable_extension "pg_stat_statements"
|
||||||
enable_extension "pg_trgm"
|
enable_extension "pg_trgm"
|
||||||
@@ -667,6 +667,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_26_130150) do
|
|||||||
t.index ["account_id"], name: "index_messages_on_account_id"
|
t.index ["account_id"], name: "index_messages_on_account_id"
|
||||||
t.index ["content"], name: "index_messages_on_content", opclass: :gin_trgm_ops, using: :gin
|
t.index ["content"], name: "index_messages_on_content", opclass: :gin_trgm_ops, using: :gin
|
||||||
t.index ["conversation_id"], name: "index_messages_on_conversation_id"
|
t.index ["conversation_id"], name: "index_messages_on_conversation_id"
|
||||||
|
t.index ["created_at"], name: "index_messages_on_created_at"
|
||||||
t.index ["inbox_id"], name: "index_messages_on_inbox_id"
|
t.index ["inbox_id"], name: "index_messages_on_inbox_id"
|
||||||
t.index ["sender_type", "sender_id"], name: "index_messages_on_sender_type_and_sender_id"
|
t.index ["sender_type", "sender_id"], name: "index_messages_on_sender_type_and_sender_id"
|
||||||
t.index ["source_id"], name: "index_messages_on_source_id"
|
t.index ["source_id"], name: "index_messages_on_source_id"
|
||||||
|
|||||||
Reference in New Issue
Block a user