|
We continued on with our experiments that call almost empty procedures thousands of times over. The results are once again revealing. Experiments are again done on a computer with Pentium 4 2.4GHz processor and 1Gb of RAM. We created three procedures that do nothing. You read right, they do absolutely nothing. CREATE PROCEDURE Proc_Return1 AS RETURN GO CREATE PROCEDURE Proc_Return2 AS RETURN DECLARE @i INT SET @i = 0 GO CREATE PROCEDURE Proc_Return3 AS RETURN 1 GO In the second procedure, there were unreachable statements after the RETURN. They were not an error. We too thought that there is no difference, but we then called all three procedures 100K times: CREATE PROCEDURE TestProc_Return1 AS BEGIN DECLARE @t datetime SET @t = getdate() DECLARE @i INT SET @i = 0 WHILE (@i <100000) BEGIN EXEC Proc_Return(1/2/3) SET @i = @i + 1 END SELECT datediff(ms, @t, getdate()) END GO And we got the following results:
What do these results mean?
Now that is more important. Note: this is actually a case where SQL 2005 is running almost 2 times slower then SQL 2000 on the same code. And that can hurt on the production! Is it the only case? No, we will continue the investigation. |
|
Disclaimer:
In many articles you will find the execution times of different queries. Please do not interpret these results scientifically or as official benchmarks. You will not even find the configuration of the computer used for these experiments because it is rather unimportant. What is important is that query A is running 2 times slower then query B. On your computer, it could be different: 1.5 or even 3 times slower. Read the full disclaimer » | |
|
|