We have an interesting table query (SQL Server 2008) that fails with a different field value. Has anyone seen this before?
This runs fine (500ms)
SELECT ROW_NUMBER() OVER (ORDER BY StatisticNo asc) AS RowId, Statistics.*
FROM Statistics
WHERE myear = 2010
This completes after a long time (>3 mins)
SELECT ROW_NUMBER() OVER (ORDER BY StatisticNo asc) AS RowId, Statistics.*
FROM Statistics
WHERE myear = 2011
The table contains data for both 2010 and 2011. Interestingly enough it runs fine as well for 2012 as a filter option which is currently an empty set. We checked for normalized problems and there is no missing or null data. The myear field is a required numeric.
There are no open or active locks on the table. It is a statistics table that is written to once a day.
You probably have an open transaction locking a
2011row. Try using theNOLOCKhint to confirm this.If that returns results without being blocked then you can find the culprit spid by running again without the hint then looking in
sys.dm_tran_lockswhilst the blocking is occurring.