|
Posted by Andrix on 06/25/06 23:24
Hi.
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
thanks!
Andrix.
Erland Sommarskog wrote:
> Andrix (elkpichico@gmail.com) writes:
> > I have a table with 20.000.000 of tuples.
> > I have been monitoring the performance of the insertion and updates,
> > but not convince me at all.
> > The table have 30 columns, what and 12 of it, are calcultated column.
> >
> > The test that i do was this:
> >
> > 1 Insertion with all the columns and calculing the calcultated columns
> > in the insertion sentence.
> >
> > 1 insertion and all the columns calculated in @vars..
> >
> > 1 insertion with the basic fields, and 10 updates.
> >
> > And the result was that the last test was the most performant.
> >
> > What is your opinion?
>
> That your posting is not very clear. I would take "calculated columns"
> to mean "computed columns", but since you can't insert explicit values
> in computed columns that does not really fit.
>
> Why not post the code you used, so it's easier to understand what you
> are talking about.
>
> --
> 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
Navigation:
[Reply to this message]
|