SQL Server 2008: performance cost for a single sql statement -


i have 2 stored procedures want compare , identify of them requires less resources , performs better. second procedure modification of first procedure , contains changed sql statements of first procedure. goal understand impact of changes in terms of query cost.

in order so, execute each procedure separately option "include actual execution plan" , analyse both execution plans. problem cannot sql query performs better in simple manner.

for example consider following execution plan of query of first stored procedure:

enter image description here

the plan shows query cost 0% relative batch , clustered index seek operator 100% relative query. have same numbers corresponding query of second procedure unfortunately not enough understand query has minimal cost.

therefore, question: there way determine cost of whole query. best table query , particular cost, e.g. cpu cost or i/o cost.

you can use set statistics io on (http://msdn.microsoft.com/en-us/library/ms184361.aspx) , set statistics time on (http://msdn.microsoft.com/en-us/library/ms190287.aspx) before running both procedures. show additional info time , input/output. remember results of procedures can cached, plans can cached, have carefully, before making conclussions. first run can slower next ones. should clean cache dbcc dropcleanbuffers , dbcc freeproccache, before making tests. should read differences between clustered , non-clustered index, seek , scan , other actions presented in plan.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -