Slow ActiveRecord - MySQL

How many results? Compare find_by_sql with connection.select_all
timing.

An index such as (id, YEAR(date_time), MONTH(date_time)) would really help, in any case.

jeremy

Around 6. select_all gave results similar to SQLyog (around 15
seconds).

It's not possible to use YEAR(date_time) as an index, is it? If I alter
my table to have different columns for the year, month and day, will
there be a good performance gain?

And while this is all good advice, I still don't understand why Rails
would have such problems with the query.

Jeremy Kemper wrote: