Difference between find_by_sql and Ruby find?

Hi,
   What is the difference between find_by_sql and ruby find method?
Where I use find_by_sql ? and Where I use find query?
Is there any performance related difference between them? If yes then,
which is feasible to use?

Thanks & Regards,
Tushar

It's not the Ruby find, it's the Rails find method. find_by_sql will let you write your own SQL query for especially complex queries or perhaps you don't like the way Rails is doing it. the find method just puts in all the stuff like "SELECT * FROM `table`".. I suggest getting yourself a good ruby book and a good rails book and learning about each and the differences.

Hi Tushar

The call which one to use and when is completely developer's call.
Of course find_by_sql is faster than Rails finder method but it is
subjected to scalability.

check-out this link for more:
http://garrickvanburen.com/archive/optimization-tips-ruby-on-rails-and-mysql

P.S. It's better to use Rails finder methods so that your application
will remain database independent.

Hi Tushar

The call which one to use and when is completely developer's call.
Of course find_by_sql is faster than Rails finder method but it is
subjected to scalability.

find just calls find_by_sql so there's not going to be a big speed
difference due to the use of find itself (for equivalent sql,
obviously if you can write a faster query than the one find generates
then find_by_sql will be faster)

Fred

Unless that find is in a loop that is called million times per request
i believe performance is not an issue. However find_by_sql makes code
uglier so unless you really need it don't use it.