Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQ-To-Sql Update - Performance Issues

I have a table which includes 230 columns and 12 million rows.

I need to update 123 fields of EACH row.

If I try to do it with LINQ-To-Sql, I get System.OutOfMemory Exception.

I know I don't get OutofMemory error if I disable object tracking. But I think I cannot perform updates if I disable object tracking.

What is the best way to update them?

like image 889
Ahmet Altun Avatar asked Mar 09 '11 12:03

Ahmet Altun


1 Answers

That is not a task suitable for LINQ-to-SQL, or frankly any ORM. You do not want to drag that much data twice over the network in that way; that should ideally be written in pure TSQL, perhaps using bulk insert / SqlBulkCopy to populate a separate table if you need to combine with data from other sources.

like image 168
Marc Gravell Avatar answered Oct 31 '22 12:10

Marc Gravell