Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Why stored procedure is faster than normal SQL query?

user-image
Question added by Bhavin Patel , .Net Developer , Imaker Infosoft
Date Posted: 2013/04/19
Ahmed Gamal
by Ahmed Gamal , Senior Microsoft Dynamics AX Developer , Bi-Technologies

bec The first time the stored procedure is run, it gets compiled.
This produces an execution plan read more http://stackoverflow.com/questions/22907/which-is-better-ad-hoc-queries-or-stored-procedures http://discuss.joelonsoftware.com/default.asp?dotnet.12.500091.75

Stored procedure can reduced network traffic and latency, boosting application performance.
Stored procedure execution plans can be reused, staying cached in SQL Server’s memory, reducing server overhead.
Stored procedures help promote code reuse.
Stored procedures can encapsulate logic.
You can change stored procedure code without affecting clients.
Stored procedures provide better security to your data.

Once created, that can be used again and again without doing compilation. That will save compilation time and get result in less time.

 

and the drawback

 

Stored procedure code is not as robust as app code, particularly in the area of looping (not to mention that iterative constructs, like cursors, are slow and processor intensive

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.