mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 09:02:46 +08:00
PERF: Add index_topic_id_percent_rank_on_posts.
Speeds up the `Posts#summary` mode query for large topics.
This commit is contained in:
parent
2d59d06916
commit
c1972f8438
|
@ -0,0 +1,9 @@
|
|||
class AddIndexTopicIdPercentRankOnPosts < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
add_index :posts, [:topic_id, :percent_rank], order: { percent_rank: :asc }
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :posts, [:topic_id, :percent_rank]
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user