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)
 tempdb locks hanging query?

Author  Topic 

dmilam
Posting Yak Master

185 Posts

Posted - 2010-11-01 : 13:53:03
Using "statistics io on", it seems that the second pass at selecting from a #temp table is hanging the query. Is this the result of too many concurrent locks in tempdb? I'm not the sysadmin so I'm just guessing here.

I should also note that I've created the #temp table outside of the dynamic SQL block which is calling this outer table. The first call
shows
 Table '#countries__________________________________________________________________________________________________________000000000277'. Scan count 8, logical reads 8251, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.


but the second pass of
 and c.country in (select country from #countries) 
is not showing. There are five tables that the first pass draws on, and the second pass shows four, the fifth being the #temp table in question. (This is production code).

dmilam
Posting Yak Master

185 Posts

Posted - 2010-11-01 : 14:05:02
...the query finally got passed this stage, with

 Table '#countries__________________________________________________________________________________________________________000000000277'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. 


Logical reads from 8251 down to 2 -- is this normal?
Go to Top of Page

dmilam
Posting Yak Master

185 Posts

Posted - 2010-11-01 : 15:23:29
Nevermind, it was a series of NOT EXISTS clauses. Still curious about logical reads, but that is now 'academic'.
Go to Top of Page
   

- Advertisement -