We migrate the website to SQL Azure and find a scenario in which there is a very significant performance difference between our current hosting and azure database.
To be clear, the stored procedure code is poorly written and can be fixed, but what I would like to understand is the reason for the performance difference.
Here is the violation code inside the procedure causing the problem
declare @curPinNumber int
set @curPinNumber = 183843692
declare @pinNumber int
set @pinNumber = 0
while @pinNumber < 10000
begin
set @curPinNumber = @curPinNumber + 1
insert into PinNumbers(pinNumber, pinNumberText, whenLastUsed, siteID)
values(@curPinNumber, right('0000' + cast(@pinNumber as varchar), 4), '1970-01-01', 999)
set @pinNumber = @pinNumber + 1
end
Below are the results of testing the procedure.
web version of azure sql database
- run # 1: 41 seconds
- run # 2: 37 seconds
- run # 3: 37 seconds
standard version s1 (15 DTU - MS has since made S1 20 DTU)
- run # 1: 3 minutes, 44 seconds
- run # 2: 3 minutes, 41 seconds
- run # 3: 3 minutes, 42 seconds
s2 50 DTU ( - )
- run # 1:1 , 51
- run # 2: 1 , 51
- run # 3: 1 , 51
premium edition P1 (100 DTU)
- run # 1: 56
- # 2: 55
- # 3: 55
premium edition P2 (200 DTU)
* vm .
sql (, 1 , 1,75 , ram sql enterprise core edn)
sql (, 2 , 3.5 , ram sql enterprise core edn)
- run # 1: 49
- # 2: 50
- # 3: 51
( 7- )
- run # 1: 6.1
- # 2: 6.0
- # 3: 6.0
, , , , http://msdn.microsoft.com/en-us/library/ms186259.aspx
BEGIN / COMMIT TRAN 10 000 1-2 - sql azure .
, Azure
: ? , , , , , .