Reputation: 4039
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?
Upvotes: 5
Views: 901
Reputation: 6890
I would definitely suggest that you change the architecture, decouple the big table into several small ones and definitely avoid linq-to-sql for this amount of data.
Create the architecture in that way that you have classes for each entity on a business level that will call stored procedures of T-SQL queries to update the data on data access level.
Upvotes: 0
Reputation: 1062590
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.
Upvotes: 10