Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query time differences

Author  Topic 

peo
Starting Member

15 Posts

Posted - 2010-12-21 : 11:53:22
I have a rather messy query with calculated columns (Avg, Max, Min, Sum) against a view and using group by and order by.
I works ok, a bit slow, I havent tried to optimize it yet.

My problem is that the query time on my medium performance laptop is about 2 seconds, but on the production server 2008R2 64-bit with 16 GB RAM it takes about 15 seconds!!
OK the server has more data in the tables, but not that much more, about the double.

Any hints where to search for this difference in behaviour is appreciated.

/P

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-21 : 11:58:06
Show us the execution plan from production and from your laptop.

Also show us the statistics io for both of them.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

peo
Starting Member

15 Posts

Posted - 2010-12-21 : 12:48:03
Thanks for breaking up my brain lock.
The execution plan was gone into some dark corner of my mind.
It immediatly pointed out the index problem I had.
Now the query executes in less than 0.2 seconds on the production server :)

/P
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-12-21 : 13:05:57
You're welcome, glad to help, and glad it was so easy!

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -