Should improve performance for rating:e and rating:q searches. Rating:s isn't isn't indexed because Postgres is unlikely to use the index for rating:s searches (the selectivity is too low, ~77% of all posts are rating:s).
6 lines
136 B
Ruby
6 lines
136 B
Ruby
class AddRatingIndexToPosts < ActiveRecord::Migration[6.1]
|
|
def change
|
|
add_index :posts, :rating, where: "rating != 's'"
|
|
end
|
|
end
|