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 2008 Forums
 SQL Server Administration (2008)
 query

Author  Topic 

mikebird
Aged Yak Warrior

529 Posts

Posted - 2010-10-26 : 05:26:41
Why does such a simple query timeout so hopelessly after an hour?

select * from Production.Product p left join Production.TransactionHistory h
on p.ProductID = h.ProductID
left join Purchasing.ProductVendor v
on p.ProductID = v.ProductID
left join Production.TransactionHistory th
on th.ProductID = h.ProductID

Why does it need handholding? 4 cores, 3.5Gb memory. Why can't it manage itself? Trying hash, loop or merge joins doesn't make any difference, although the plan look quite different. tempdb gets to 1,219Mb

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-26 : 05:54:37
Are there proper indexes?
Is the plan showing INDEX SEEK?

If nothing helps then maybe there is a problem with parallelism!
In this case try to add
OPTION maxdop(1)
at the bottom of your query.


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

- Advertisement -