Files
danbooru/db/migrate/20200816175151_add_deleted_index_on_posts.rb
evazion f337902c57 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.
2020-08-16 14:31:47 -05:00

6 lines
145 B
Ruby

class AddDeletedIndexOnPosts < ActiveRecord::Migration[6.0]
def change
add_index :posts, :is_deleted, where: "is_deleted = true"
end
end