Is using more stored procedure in an application will cause the low performance of the application ? Is it reduces the speed of web application ?
I am Using SQL server 2005 database
Is using more stored procedure in an application will cause the low performance of the application ? Is it reduces the speed of web application ?
I am Using SQL server 2005 database
SQL Server basically goes through these steps to execute any query (stored procedure call or ad-hoc SQL statement):
The point is: ad-hoc SQL and stored procedures are treatly no differently.
If an ad-hoc SQL query is properly using parameters - as it should anyway, to prevent SQL injection attacks - its performance characteristics are no different and most definitely no worse than executing a stored procedure.
Stored procedure have other benefits (no need to grant users direct table access, for instance), but in terms of performance, using properly parametrized ad-hoc SQL queries is just as efficient as using stored procedures.
Using stored procedures over non-parametrized queries is better for two main reasons:
since each non-parametrized query is a new, different query to SQL Server, it has to go through all the steps of determining the execution plan, for each query (thus wasting time - and also wasting plan cache space, since storing the execution plan into plan cache doesn't really help in the end, since that particular query will probably not be executed again)
non-parametrized queries are at risk of SQL injection attack and should be avoided at all costs
Using more stored procedures" then what is necessary?, then yes this will impact your application.
If all your required data you are retrieving is via stored procedures then this, for the most, will be the best way to retrieve data.
You could also answer that, yes, removing stored procedures would speed up your application but I'm sure would not work or have a lot less content / functionality...
I would focus more on how your database is designed.
Ensure referential integrity (set up relationships between your tables).
Make use of primary keys and indexes.
These are the things which will have real impact in speeding up your application, for the data retrieval part anyway.