title: Ruby on Rails: Model.all.each vs find_by_sql("SELECT * FROM model").each?
body: <p>I'm fairly new to RoR. In my controller, I'm iterating over every tuple in the database. For every table, for every column I used to call </p>
  
  <p><code>SomeOtherModel.find_by_sql("SELECT column FROM model").each {|x| #etc }</code></p>
  
  <p>which worked fine enough. When I later changed this to</p>
  
  <p><code>Model.all(:select =&gt; "column").each {|x| #etc }</code></p>
  
  <p>the loop starts out at roughly the same speed but quickly slows down to something like 100 times slower than the the find_by_sql command. These calls should be identical so I really don't know what's happening.</p>
  
  <p>I know these calls are not the most efficient but this is just an intermediate step and I will optimize it more once this works correctly. </p>
  
  <p>So to clarify: Why in the world does calling Model.all.each run so much slower than using find_by_sql.each?</p>
  
  <p>Thanks!</p>