Reputation: 105
I'm using stored procedures to retrieve data for a few requirements which I think cannot be achieved using simple queries.
But in general, are stored procedures better, faster and efficient than simple queries?
Upvotes: 0
Views: 393
Reputation: 625
Its a long debate but generally they are faster.
The reason why they are faster is
The Cache, it benefits in a way that the first time the stored procedure is executed, database server creates an execution plan, which is cached for reuse.
Pre-parsed SQL, no need to parse it every time.
Pre-generated query execution plan
Reduced network traffic
Ability to edit without recompiling
SQL injection attacks
Upvotes: 1