4

I have a table in database with a primary key say emp_pk. Now using LINQ I am trying to perform some operations on it. When I change few properties and call,

context.SubmitChanges();

ideally the where clause should contain where emp_pk = value.

But when I review the query from SQL profiler, I see lot of conditions in where clause, which I believe are generated by LINQ engine. This is causing a major performance issue.

Can anyone please help me in this case to optimize the query?

nemesv
  • 138,284
  • 16
  • 416
  • 359
VJOY
  • 3,752
  • 12
  • 57
  • 90
  • This is causing a major performance issue: really?? Why?Or is the performance issue created by linq-2-sql updating a lot of records one at a time. – Pleun Apr 13 '12 at 16:26
  • 10k in itsself is not a problem. The question is how many you update at a time. If you are updating large amounts of records at the same time Linq2Sql is not the best choice performancewise – Pleun Apr 16 '12 at 19:06

1 Answers1

6

That's because optimistic concurrency check is enabled. You can turn it off per column by setting Update Check=never per column in the dbml designer

Eivind T
  • 1,059
  • 9
  • 14
  • I am using SQLMetal to generate classes. Please let me know how I can do the same with SQLMEtal. – VJOY Apr 13 '12 at 08:44
  • I saw the class generated by SQLMetal. For some of the columns this property is set, but not for all. And for the columns where this property is set, these columns are used in SET statement. – VJOY Apr 13 '12 at 08:51