Reputation: 45
I have an ASP.Net MVC software with SQL server backend. I have a table with 80 column, currently counting about 975413 records. I am using Linq for the transactions with database. The problem is that I noticed that it is taking so long time to execute commands like SaveChanges(), Find(), Select().. and so.
How can I reduce the time taken to execute such Linq commands...
Upvotes: 2
Views: 698
Reputation: 102793
You'll have to do some profiling.
If Linq is generating silly SQL, then you might have to tweak your Linq code, or consider using raw SQL commands. If the execution strategies are showing unwanted strategies like table scans, then you might want to consider adding indices, or changing them (re-ordering the keys, adding included columns).
Note also that Linq is generally quite slow. But really, 1 million records isn't that big, I'm sure you can improve performance using the above.
Upvotes: 4