title: Rails where query
body: <p>i have to write query </p>
  
  <pre><code>circular_ids = [array of ids about 500 elements]
  
  flyers = Flyer.where(flyer_id: circular_ids)
  </code></pre>
  
  <p>but my database have died during request</p>
  
  <p>How to optimize it?</p>