Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Need help with query optimization

$
0
0

I have one simple query to optimize but somehow after creating couple of index this query is still having more logical reads and time.

DECLARE @CURRENT smalldatetime
set @current = '6/30/2013'

select KeyInstn, MAX(dateendedstandard) DateEndedStandard 
from InternalEstimate  with (index(AI_OperatorCBGEstimate_HAP))
where dateendedstandard < @Current and mostrecentsequence = 1 and UpdOperation<2 
group by KeyInstn

I have created index as 

CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[OperateEstimate] ([MostRecentSequence],[DateEndedStandard],[UpdOperation])
INCLUDE ([KeyInstn])
GO

But still logical reads are about 66,000 and taking 7-8 second to execute.

Any help would be great help.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>