DEV: add topic_id index to incoming_emails table (#26004)

This table may grow to be large, and an index on this column improves
performance for SELECT queries.
This commit is contained in:
Michael Fitz-Payne 2024-03-04 13:50:01 +10:00 committed by GitHub
parent 718a91c297
commit f880f1a42f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -104,5 +104,6 @@ end
# index_incoming_emails_on_imap_sync (imap_sync)
# index_incoming_emails_on_message_id (message_id)
# index_incoming_emails_on_post_id (post_id)
# index_incoming_emails_on_topic_id (topic_id)
# index_incoming_emails_on_user_id (user_id) WHERE (user_id IS NOT NULL)
#

View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
class TopicIdOnIncomingEmailIndex < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_index :incoming_emails, :topic_id, algorithm: :concurrently
end
end