Ed Prochak schrieb:
Quote:
On Nov 25, 5:19 pm, noam gariani <noamgari... (AT) gmail (DOT) com> wrote:
To do update for a record , or insert a record to a db?
Depends.
Why do you care? |
As I know in many cases an Insert can be done faster, because the DB
does not have take care of concurrency, to lock the row, keep the before
image for rollback and find the rows to update .... unlock ....after the
commit ... so there are many easy points the DB-Engine can be optimized
in performance doing an insert, but this does not say inserts are always
faster than updates and does never mean do an delete+insert instead of
updates.
Some Databases do any update as an kind of insert operation.
Like find the block -- change it in memory -- insert changed block to
datafile and mark old block as deleted. In that databases inserts and
updates are quite equal.