Store Procedure vs LINQ

Posted by Naraayanan under C# on 7/26/2012 | Points: 10 | Views : 4432 | Status : [Member] | Replies : 4
Hi,
i am learning LINQ. SO please tell me what is the difference between Store Procedure and LINQ?[as Performance wise]

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/



Responses

Posted by: Ogipansrk on: 8/2/2012 [Member] Starter | Points: 25

Up
0
Down
Hello Narayan,

Linq and StoredProcedures are two different things.

Hope you worked on Ado.net before .

Linq simplfies the way you access your database and make developer life easy.


Comming to performance , Ado.net is much faster than Linq.








Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 8/2/2012 [Member] Starter | Points: 25

Up
0
Down
StoredProcedure is where v ll write queries..
Linq is object Relational mapper where we ll drag storeprocedure,tables,functions and use it

Queries in StoredProcedure will be "select colname from tablename where condition"
Queries in Linq will be "from r in tablename where condition"

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mallesh on: 8/2/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
According to my knowledge, I can prefer Stored Procedures over LINQ. LINQ is a handy tool, but it

has some disadvantages while we operate on the database(sql server). If your application or system

consists multilevel (n-tired) of data processing and having a large huge number of transactions, then

I would suggest SP is the best thing. Infact in any case SP would be the best as it runs in the

DB - provides direct object relational mapping. If you use Linq, it runs in the App server or web server,

it faces some difficulty with the Database server effects on memory utilization and the turn around time.

Then it will definetely slow down the operation because of the above reasons mentioned. So SP would

be the better option as it completely evades the application logic from the logic which is been extracted out of DB operations.


Changing the any Linq code consumes more time compare with SP code.


In othe side, Linq vs stored procedure, it depends on your needs. Whenever an operation that will handle

large amounts of data between tables for analysis, data processing, and display reports, a stored procedure

is a good option because large amounts of data will be traveling through the various layers into to the application.

And any other cases used to involves small and fast data transfer between app and db server Linq is a pretty good.

== Mallesh

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajkatie on: 8/2/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Kindly refer following link
http://stackoverflow.com/questions/752064/performance-difference-between-linq-and-stored-procedures

Rajesh Patel
.Net Trainer(MSCD | MCT | MS)
Brainbench (Asp.Net 4.5 and C# 5.0)

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response