modqueue: fix performance regression from including appeals.
* Add index on posts.is_deleted. The modqueue was slow because we the appeal condition wasn't constrained to deleted posts, so it degraded to a full table scan. * Avoid extra queries for calculating the page count and disapproval counts.
This commit is contained in:
5
db/migrate/20200816175151_add_deleted_index_on_posts.rb
Normal file
5
db/migrate/20200816175151_add_deleted_index_on_posts.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddDeletedIndexOnPosts < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_index :posts, :is_deleted, where: "is_deleted = true"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user