Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Why stored procedure is faster than normal SQL query?

user-image
Question ajoutée par Bhavin Patel , .Net Developer , Imaker Infosoft
Date de publication: 2013/04/19
Ahmed Gamal
par 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