SqlStarter (10/30/2014)
I have a SP SPone. i have optimized that and kept it as SPone_Optimized. i would like to test the both SP's execution time to find out how best the optimized one fares.i planned to test it as follows
declare @starttime datetime,@endtime datetime
declare @count int=0
select @starttime=getdate()
while(@i<10000)
begin
execute SPone_optimized @param='value1'
end
select @endtime=getdate()
select datediff(ms,@stattime,@endtime) 'total_exec_time'
----- for the SP that is before optimize
declare @starttime datetime,@endtime datetime
declare @count int=0
select @starttime=getdate()
while(@i<10000)
begin
execute SPone @param='value1'
end
select @endtime=getdate()
select datediff(ms,@stattime,@endtime) 'total_exec_time'
Please tell me whether the idea makes sense...or any other better way to find the same... thanks in advance
Shifting gears a bit, what does SPone do and why are you trying to process by single row rather than a set of rows? Things will be much easier and faster all around if you can process in sets rather than using RBAR.
--Jeff Moden
Change is inevitable... Change for the better is not.