SQL Server - READPAST, UPDLOCK update method? -


We need another major update, as it is, due to the risk of widespread locking problems, downtime will be required. In fact, we want to update hundreds of millions of rows during business hours.

Now, to reduce updates to manage & lt; Help in the size of 5000 batch, but I was wondering if it is possible that it is possible to create templates for reading and locking the available rows, boil them, and go to the next batch? The idea is that in this way we can patch up some 95% of the data with minimal risk, after which the remaining set of data can be small so that during the slow period, updates can be made once.

Yes, I know it sounds weird, but how will I have to bear with this to bear this?

I was thinking something like this:

  WHILE @@ ROWCOUNT & gt; Select the Top 5000 SID from the upstate-top (5000) T set T.V.R.D.L = 'ASD' (RedPaste, UIPLok) where X = Y and Z = W etc. ...) SRC on SRC ID = T.ID END  

Any ideas? Actually, the last thing I want to do is to get trapped in other potential long-running transactions for this query or in exchange for doing so with others. So the script I'm seeing here is a script that will drop the locked rows, it can update with minimum risk to join the lock or deadlock, so it's time for hours or more during uptime Can be run safely.

In the table for single-table updates, simply (READPAST) ADD:

UPDATE TOP (5000) (READPAST) SET VALUE = 'ASD' where X = Y and Z = W etc ... esoteric with ...

If you are lucky enough to include a table you can simply add (READPAST) and updates will only add a special lock on those rows that will be updated.

If there is more than one table, then it becomes more complicated. Also, be very cautious with the WHERE clause, because it can add more load than expected - the first few batches are fine but if you are satisfied to progressively It is necessary to scan the entire table to find enough rows, so it will get worse. You can assume a brief time value for each batch.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -