In SQL, is UPDATE always faster than DELETE+INSERT?

前端 未结 15 2196
梦谈多话
梦谈多话 2020-11-29 20:01

Say I have a simple table that has the following fields:

  1. ID: int, autoincremental (identity), primary key
  2. Name: varchar(50), unique, has unique index<
15条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 20:53

    It depends on the product. A product could be implemented that (under the covers) converts all UPDATEs into a (transactionally wrapped) DELETE and INSERT. Provided the results are consistent with the UPDATE semantics.

    I'm not saying I'm aware of any product that does this, but it's perfectly legal.

提交回复
热议问题