Linq VS stored procedure

Wednesday, 29 November 2017

Linq VS stored procedure

1) Stored procedure is a best way for writing complex queries as compared to LINQ.

2) Stored procedures are faster as compared to LINQ query since they have a predictable execution
    plan and can take the full advantage of SQL features.

3) When a stored procedure is being executed next time, the database used the cached execution plan
    to execute that stored procedure.

4) LINQ has full type checking at compile-time and Intellisense support in Visual Studio as compared
    to stored procedure. This powerful feature helps you to avoid run-time errors.

5) LINQ allows debugging through .NET debugger as compared to stored procedure.

6) LINQ also supports various .NET framework features like multi –threading as compared to stored
    procedures.

7) LINQ provides the uniform programming model (means common query syntax) to query the
    multiple databases while you need to re-write the stored procedure for different databases.

8) Deploying LINQ based application is much easy and simple as compared to stored procedures
    based. Since in case of stored procedures, you need to provide a SQL script for deployment but in
    case of LINQ everything gets complied into the DLLs. Hence you need to deploy only DLLs.

9) LINQ query is compiled each and every time while stored procedures re-used the cached
    execution plan to execute. Hence, LINQ query takes more time in execution as compared to stored
     procedures.

10) LINQ is not the good for writing complex queries as compared to stored procedures.

11) LINQ is not a good way for bulk insert and update operations.

12) Performance is degraded if you don't write the LINQ query correctly.

13) If you have done some changes in your query, you have to recompile it and redeploy its DLLs to        the server.

No comments:

Post a comment