|
Posted by Erland Sommarskog on 06/26/06 22:02
Andrix (elkpichico@gmail.com) writes:
> The test that i do, were this:
> select @PK = .....
> INSERT INTO shared_calc
> VALUES (@PK,10,20,223,"calculo trivial",....... ,@imp * @ohter, ....)
>
> I mean that in the same Insert sentence, i do all the calcs to insert
> in the table.
>
> the other,
> was
> select @cal1 = @imp * @other
> select @cal2 = @imp * @other - @umbral
>
> select @PK = .....
> INSERT INTO shared_calc
> VALUES (@PK,10,20,223,"calculo trivial",....... ,@calc1,@calc2, ....)
>
> and the last one was:
> select @PK = .....
> INSERT INTO shared_calc
> VALUES (@PK,10,20,223,"calculo trivial",....... )
>
> select @cal1 = @imp * @other
> select @cal2 = @imp * @other - @umbral
>
> update shared_calc_imp
> set calc1 = @calc1
> where pk = @PK
>
> update shared_calc_imp
> set calc2 = @calc2
> where pk = @PK
And you are saying that the last test had the best performance?
Surprising.
But how many times did you run each test? Did you ensure that there
was no other load on the server? Did you work with the same table
that you just added to each time? Or did you recreate the table for
each test? And what were the results in numbers? Were the huge
differences?
Running performance tests requires care to avoid sources of error. One
very important is that any measurement below 50 ms contains to much
white noise to be reliable.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|