# Can someone explain sql server performance differences?

**URL:** <https://www.ruby-forum.com/t/can-someone-explain-sql-server-performance-differences/112142>\
**Category:** Rails\
**Created:** [August 15, 2007, 9:34pm UTC](https://www.ruby-forum.com/t/can-someone-explain-sql-server-performance-differences/112142 "2007-08-15T21:34:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![typej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@typej](https://www.ruby-forum.com/u/typej)\
**Post date:** [August 15, 2007, 9:34pm UTC](https://www.ruby-forum.com/t/can-someone-explain-sql-server-performance-differences/112142/1 "2007-08-15T21:34:32Z")

</div>

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 L.

---

<div class="post-metadata">

**Author:** ![typej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@typej](https://www.ruby-forum.com/u/typej)\
**Post date:** [August 15, 2007, 10:12pm UTC](https://www.ruby-forum.com/t/can-someone-explain-sql-server-performance-differences/112142/2 "2007-08-15T22:12:38Z")

</div>

> 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.
