declare @a int
set @a=0
while @a<10
begin
declare @time datetime
set @time=getdate()
select count(*) from test left join t1 on t1.id = test.id
insert into time values (datediff(ms,@time,getdate()))
set @a=@a+1;
end