Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / July 2008

Tip: Looking for answers? Try searching our database.

Does Stored Procedure increase performance.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark - 29 Jul 2008 17:03 GMT
For example I want to get salary from Customers table based on CustomerID.

I can create a Stored procedure called GetCustomerSalary with CustomerID as
parameter
OR
I can write parameterized query "Select Salary fromm Customers where
CustomerID=@CustomerID".

Will there any effect in performance.
My question is only about performance not about security and other issues.

Thanks for any help you can provide.
Mark
Tibor Karaszi - 29 Jul 2008 18:33 GMT
The possible performance gain for using a procedure for this particular example is probably barely
measurable. There are other cases, where there might be performance differences (Google for
"parameter sniffing" and read http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx for
more details).

(And as you already mentioned there can be other advantages using procedures, but I won't go into
them here, as per your request.)

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

> For example I want to get salary from Customers table based on CustomerID.
>
[quoted text clipped - 7 lines]
> Thanks for any help you can provide.
> Mark
Rick Sawtell - 29 Jul 2008 18:38 GMT
> For example I want to get salary from Customers table based on CustomerID.
>
[quoted text clipped - 9 lines]
> Thanks for any help you can provide.
> Mark

There is a lot more at play than a simple, yes/no.   Read through the
following

http://msdn.microsoft.com/en-us/library/ms181055.aspx

And once you get through that one, put on your thinking cap and tackle this
one.

http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx

Rick Sawtell
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.