How do I atomically replace a set of rows?
I have a table of products which is populated from a file. When the file
is updated I need to replace all the rows in the table with the new data.
The simple way to do this is to delete all the existing rows and then
insert the new rows. However I am concerned that if one transaction is
reading the rows at the same time as the inserts then the transaction
could end up read rows from both sets.
So how do I stop this? If I use SERIALIZABLE transactions then I reckon
that in this situation there could be a deadlock.
No comments:
Post a Comment