It takes about 40 seconds for my query to the sql server (mysql) to complete.
I would wager that something is wrong with your query.My guess is that you have not taken advantage of eager-loading.
Simple example:
Say a project belongs_to :creator
I want to list all projects.
@projects = Project.find :all
Then I call @project.creator in a loop
@projects.each do |project| project.creator end
That causes one additional db hit for each iteration in the loop.
I should do
@projects = Project.find :all, :include=>[:creator]
That will do a left-join for me, bringing in all projects and creator info into my objects. This is the #1 cause of slow Rails apps in my experience.
The second cause? Failure to properly index the database tables.