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 timeout problem

Author  Topic 

Darrell67
Starting Member

2 Posts

Posted - 2011-07-16 : 06:25:36
Hi

I am having trouble with a new view I am writing which joins two existing views (both of which are multi tabled). Either SQL (2005 Enterprise) gives a timed out msg or I end up aborting the query after 5 mins or more.

The strange thing is both Views can be individually executed in less than than a second.

If I repeat the above on my laptop running 2008 R2 express the new view will complete in 2 seconds, yet the quad core xeon server can't do it in 5 mins!?

The number of rows aren't vast, the final output is 227 rows from starting out as 200,000 rows in one of the tables.

I am sure the query is not at fault and even if it is not written optiumally the server should be at least on par with my laptop.

The server is running fine, as other queries (large) are all running fine.

Any thoughts?

Thanks

Darrell

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-07-16 : 12:55:27
Try
OPTION (maxdop=1)
at the end of your query statement.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

Darrell67
Starting Member

2 Posts

Posted - 2011-07-16 : 18:09:51
Thank for the suggestion Webfred

Tried Option (maxdop 1) and (maxdop 2)

Unfortunatly it made no difference.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-16 : 20:18:31
Check the execution plan. Post it here if possible. You will likely see different execution plans. If you don't, then the communication between the two systems is likely to blame.

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 -