Question regarding performance.
If I have a query such as:
Select UserId, Firstname,lastname from members where country='can'
If I were to call this from an .net executable as straight SQL to the Database vs. encapsulating the command in a stored procedure and calling the procedure.
What would be the performance differences? Would their be any issues (outside of security) that would make me choose to place the call in a Procedure?
Thanks
It probably doesn't matter in this case. Executing the SELECT statement using a parameterized command object will provide same benefit as calling SP with slighly more overhead. RPC execution for SP calls provide better performance than sending the entire SQL text. The answer is that it depends on your needs. Changing SQL statements embedded in applications is often harder than modifyin a SP. You can also take a look at the whitepaper below for more information:
http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx
No comments:
Post a Comment