Subject | RE: [firebird-support] What is better: UPDATE or DELETE + INSERT? |
---|---|
Author | Leyne, Sean |
Post date | 2015-09-16T15:40:06Z |
> They will generate a comparable amount of garbage, but I think updating theI don't think so.
> existing records is better than delete + insert, especially if there are also
> foreign key references to those records.
Unless you are updating every column in the row, the UPDATE will generate a smaller disk footprint, as the new record version will only include the updated fields -- not a full copy of the row.
Then there is the impact on index structures that Vlad has pointed out.
From a performance point of view, it would be *much faster*, if you are able to:
- disable all indexes for the target table,
- delete all rows,
- import new rows and
- reactivate all indexes for the target table
This would likely require that you have near-exclusive access/use of the target table.
Sean