posts: add index on rating column.

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).
This commit is contained in:
evazion
2021-01-26 19:24:18 -06:00
parent f7ea4917e5
commit 78892e6239
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
class AddRatingIndexToPosts < ActiveRecord::Migration[6.1]
def change
add_index :posts, :rating, where: "rating != 's'"
end
end