Subject | RE: [firebird-support] What is better: UPDATE or DELETE + INSERT? |
---|---|
Author | Mordico1 |
Post date | 2015-09-16T17:57:17Z |
Nothing to think of. If you
need update go with update otherwise delete and insert is better.
Trust yourself.
Regards
Bogdan
--- Original message --- | |
From: | 'Leyne, Sean' Sean@... [firebird-support] <firebird-support@yahoogroups.com> |
Date: | 16. september 2015 5.40.22 pop. |
Subject: | RE: [firebird-support] What is better: UPDATE or DELETE + INSERT? |
To: | firebird-support@yahoogroups.com |
> They will generate a comparable amount of garbage, but I think updating the
> existing records is better than delete + insert, especially if there are also
> foreign key references to those records.
I don't think so.
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