I know indexes reduce data modification performance, but I have a task where (almost) all updates are done on items in a sequential order. Would a clustered index improve or reduce performance in updating these rows?
The clustered index would be on column id
where id
is an IDENTITY
column. id
is thus never changed and will be sequential (in addition rows should never be deleted).
This is the format of my update statements:
UPDATE [table] SET value = 1
WHERE id IN (1,2,3,4...)
The values are not necessarily continous however. A sequence of IN (1,2,4,5)
is also possible if id=3
is not set to be updated, but they will always be in order.
When all updates are in sequential order, will a clustered index improve or reduce performance?
id
? Do you have any other indexes on that table? Isid
anIDENTITY
column?id
is anIDENTITY
.