Click here to Skip to main content
14,241,154 members
   

Database

 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson23-May-19 7:52
protectorJörgen Andersson23-May-19 7:52 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson23-May-19 22:08
protectorJörgen Andersson23-May-19 22:08 
GeneralRe: Best way to batchprocess a large update Pin
Richard Deeming24-May-19 0:44
mveRichard Deeming24-May-19 0:44 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson24-May-19 1:45
protectorJörgen Andersson24-May-19 1:45 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson26-May-19 23:17
protectorJörgen Andersson26-May-19 23:17 
AnswerRe: Best way to batchprocess a large update Pin
Eddy Vluggen24-May-19 0:04
mveEddy Vluggen24-May-19 0:04 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson24-May-19 1:24
protectorJörgen Andersson24-May-19 1:24 
AnswerRe: Best way to batchprocess a large update Pin
#realJSOP29-May-19 0:43
mve#realJSOP29-May-19 0:43 
Add WITH(NOLOCK) to your selects and joins:

DECLARE
        @LastID int = 0,
        @NextID int,
        @RC int = 1;
    
WHILE (@RC > 0)
BEGIN
    SELECT  TOP 5000
            @NextID = s.id
    FROM    Source s WITH(NOLOCK)
    WHERE   s.id> @LastID
    ORDER BY s.id
    ;
    UPDATE  t
        SET  ------
    FROM    Source s
    JOIN    Target t WITH(NOLOCK) ON t.id = s.id
    WHERE   s.id > @LastID 
        AND s.id <= @NextID 
    ;
    SET @RC = @@ROWCOUNT;
    SET @LastID = @NextID ;
END

".45 ACP - because shooting twice is just silly" - JSOP, 2010
-----
You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
-----
When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

GeneralRe: Best way to batchprocess a large update Pin
Richard Deeming29-May-19 0:52
mveRichard Deeming29-May-19 0:52 
GeneralRe: Best way to batchprocess a large update Pin
#realJSOP29-May-19 1:06
mve#realJSOP29-May-19 1:06 
GeneralRe: Best way to batchprocess a large update Pin
Richard Deeming29-May-19 1:12
mveRichard Deeming29-May-19 1:12 
GeneralRe: Best way to batchprocess a large update Pin
#realJSOP29-May-19 1:20
mve#realJSOP29-May-19 1:20 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson29-May-19 2:59
protectorJörgen Andersson29-May-19 2:59 
GeneralRe: Best way to batchprocess a large update Pin
#realJSOP29-May-19 5:13
mve#realJSOP29-May-19 5:13 
AnswerRe: Best way to batchprocess a large update Pin
#realJSOP29-May-19 1:14
mve#realJSOP29-May-19 1:14 
GeneralRe: Best way to batchprocess a large update Pin
Jörgen Andersson29-May-19 3:01
protectorJörgen Andersson29-May-19 3:01 
QuestionMongoDB Int Primary Key Pin
Kevin Marois17-May-19 8:41
professionalKevin Marois17-May-19 8:41 
AnswerRe: MongoDB Int Primary Key Pin
jschell18-May-19 7:09
memberjschell18-May-19 7:09 
GeneralRe: MongoDB Int Primary Key Pin
Kevin Marois20-May-19 6:21
professionalKevin Marois20-May-19 6:21 
GeneralRe: MongoDB Int Primary Key Pin
jschell23-May-19 5:33
memberjschell23-May-19 5:33 
QuestionMySQL Pin
Member 1437004615-May-19 3:07
memberMember 1437004615-May-19 3:07 
AnswerRe: MySQL Pin
Richard MacCutchan15-May-19 3:12
protectorRichard MacCutchan15-May-19 3:12 
GeneralRe: MySQL Pin
Member 1437004615-May-19 20:24
memberMember 1437004615-May-19 20:24 
GeneralRe: MySQL Pin
Richard MacCutchan15-May-19 21:17
protectorRichard MacCutchan15-May-19 21:17 
GeneralRe: MySQL Pin
Member 1437004615-May-19 20:25
memberMember 1437004615-May-19 20:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.