Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index was not longer optimized
Message
 
 
To
06/04/2010 13:06:08
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01458951
Message ID:
01458969
Views:
42
>>Could it be parameter sniffing problem? Are you running an SP?
>>
>>http://pratchev.blogspot.com/2007/08/parameter-sniffing.html
>
>This is how the command is done:
>
>
>DECLARE @NoMember Integer
>
>SET @NoMember=1
>
>SELECT Thread.Numero,Thread.Title,Thread.Url,Thread.AddDate
> FROM (SELECT TOP 10 Reply.NoThread FROM Reply (NOLOCK) WHERE Reply.NoMember=@NoMember ORDER BY 1 DESC) Temp
> INNER JOIN Thread ON Temp.NoThread=Thread.Numero 
>
>
>My version is:
>
>
>Microsoft SQL Server Management Studio   10.0.1600.22 ((SQL_PreRelease).080709-1414 )
>Microsoft Analysis Services Client Tools 2007.0100.1600.022 ((SQL_PreRelease).080709-1414 )
>Microsoft Data Access Components (MDAC)  2000.086.3959.00 (srv03_sp2_rtm.070216-1710)
>Microsoft MSXML                          2.6 3.0 4.0 6.0 
>Microsoft Internet Explorer              8.0.6001.18702
>Microsoft .NET Framework                 2.0.50727.3603
>Operating System                         5.2.3790
>
>
>Is there something newer?

Your order by here is strange. I would probably re-write the whole query as
select * from (select T.Numero, T.Title, T.Url, T.AddDate, row_number() 
over (partition by R.NoThread order by R.NoThread) as Row from Thread T LEFT JOIN Reply R on T.NoThread = R.NoThread) X 
where Row <=10
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform