title: What is difference in using find_by_sql and our normal rails query method?
body: <p>I have a small doubt regarding the execution time for MySQL query in my rails application.</p>
  
  <p>I have written a query like</p>
  
  <pre><code>  @claims = Claim.joins('left join drugs on claims.ndc = drugs.ndcupchri left join pharmacies on claims.nabp = pharmacies.nabp').select('claims.*, drugs.*, pharmacies.* ').where('claims.member_id = '218').group(:ndc)
  </code></pre>
  
  <p>and I wrote a the same query using find_by_sql</p>
  
  <pre><code>   @sql = "SELECT claims.*, drugs.*, pharmacies.* FROM `claims` 
            left join drugs on claims.ndc = drugs.ndcupchri 
            left join pharmacies on claims.nabp = pharmacies.nabp 
            WHERE (claims.member_id = '218') GROUP BY ndc "
  
    @claims = Claim.find_by_sql(@sql)
  </code></pre>
  
  <p>Sometimes I see that using find_by_sql the execution time of the query is pretty fast when compared to the other. Is this correct. </p>
  
  <p>Which one of the above pattern is a better accepted method, when it comes to performance oriented. Please share your ideas.</p>
  
  <p>Currently am using Rails 3.0.7</p>