Subject Performance Question
Hello,

We have one table in our application that gets alot of hits. We are
having problems with corrupted indexes in this table.

My question is:

Is it more efficient to delete records and then insert new records or to
update existing records multiple times?


For example: (primary 1 and primary 2 make up the primary key on the table)

Primary1 Primary2 Value
1 1 10
1 2 50
1 3 60

needs to be changed to:

1 1 20
1 2 60

There is a fairly complex calculation that is coded in a stored
procedure to come up with the values. The number of records can vary.

Is it better to:

1) Delete the three records
2) Insert the two records

Or to:

1) Update all records to value of 0
2) Calculate the values and change existing records (or insert new
records if need be)
3) Delete any records that still have a value of 0
4) This method will typically have alot of updates and not very many
inserts and deletes.


I hope this makes sense. In actuality, the data is more complex, but I
feel the example shows what we are after.

Any information regarding the best course of action would be appreciated.

Todd