tsql - Writing code to Process 25,000 records C#, T-SQL, Quick Performance is key -
what efficent way loop through 25,000 records, , based on prewritten vb logic wont ever change(99% sure), update result column in table value of 1, 2 or 3?
performance , reliabilty important here. called via client server app on network nice able call web app. thinking 3 different ways t-sql, c#.
a. write object executes stored procedure gets 25,000 records, use foreach collection go through each record , based on c# logic, call object @ each record executes stored procedure update row. call object 25,000 times (and proc assume reuse execution plan)
or
b. write stored procedure gets 25,000 records, use forbidden cursor go through each record , based on t-sql logic, update row in stored procedure.
or
updated: solution it's worth going persisited computed columns, , breaking loop smaller update statements update column (all wrapped in transaction). see article below. think fast, compared loop..
you have condition determines wheter value should 1,2 or 3. 3 update queries. each query update records based on condition determines if value should 1, 2 or 3. don't pull data down machine if can it.
Comments
Post a Comment