You should use batch query ActiveRecord Batch query
@search = Policy.find_by_sql("select * from policies where deleted = 0 AND (state = 0 OR state= 1) ORDER BY state ASC ")
@search = Policy.where("deleted = 0 AND (state = 0 OR state = 1)").order("state ASC")
In your partial
<% @results.find_each(:batch_size => 1000) do |policy| %>
<%= policy.num_policy %>
<% end %>