mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 23:49:34 +08:00
PERF: Add index_reply_id_on_post_replies
.
Speeds up the reference posts query in `Email::Sender#send`.
This commit is contained in:
@ -110,7 +110,8 @@ module Email
|
||||
"<topic/#{topic_id}/#{post_id}@#{host}>"
|
||||
|
||||
referenced_posts = Post.includes(:incoming_email)
|
||||
.where(id: PostReply.where(reply_id: post_id).select(:post_id))
|
||||
.joins("INNER JOIN post_replies ON post_replies.post_id = posts.id ")
|
||||
.where("post_replies.reply_id = ?", post_id)
|
||||
.order(id: :desc)
|
||||
|
||||
referenced_post_message_ids = referenced_posts.map do |referenced_post|
|
||||
|
Reference in New Issue
Block a user