Add index to field: create table(:posts) do add :rating, :integer end create index(:posts, [:rating])