can someone explain sql server performance differences?

Friends,

I was wondering if any Rails/SQL Server experts could offer some help in regards to a question I had.

Lately I have been getting some “timeout expired” errors in rails for some of my find_by_sql queries. When I load these pages, they often take upwards of 2-4 minutes and eventually they throw a timeout exception.

When I run the exact same query in SQL Enterprise Manager, the queries execute in under a second.

My question is, what is the difference between running a query in rails and in enterprise manager to account for the difference in computing time?

Any insight would be greatly appreciated,
Jin Lee

Friends,

I was wondering if any Rails/SQL Server experts could offer some help in
regards to a question I had.

Lately I have been getting some "timeout expired" errors in rails for some
of my find_by_sql queries. When I load these pages, they often take upwards
of 2-4 minutes and eventually they throw a timeout exception.

When I run the exact same query in SQL Enterprise Manager, the queries
execute in under a second.

My question is, what is the difference between running a query in rails and
in enterprise manager to account for the difference in computing time?

What type of query? What size is the result set? If that query is returning a million rows, AR is going to instantiate a million objects. Which is going to take a lot of time....

Without having any idea what sort of query on what sort of data it's gonna be hard to say.