Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6972961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:02:40+00:00 2026-05-27T17:02:40+00:00

In fact, if I call the stored procedures from my application, I need a

  • 0

In fact, if I call the stored procedures from my application, I need a connection to my DB.

So, why calling a “stored procedures” should be faster than “passing a SQL query” string to be executed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:02:41+00:00Added an answer on May 27, 2026 at 5:02 pm

    SQL Server basically goes through these steps to execute any query (stored procedure call or ad-hoc SQL statement):

    1) syntactically check the query
    2) if it’s okay – it checks the plan cache to see if it already has an execution plan for that query
    3) if there is an execution plan – that plan is (re-)used and the query executed
    4) if there is no plan yet, an execution plan is determined
    5) that plan is stored into the plan cache for later reuse
    6) the query is executed

    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.

    Update: 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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Other than the fact that ASP.NET MVC Web Application has more clarity in its
In fact, my question concerns an algorithm. I need to be able to attach
I'm designing the Fact and Dimension tables for a data warehouse currently using SQL
I would like to call this stored procedure with jdbc: sp_msforeachtable ALTER TABLE ?
I have stored procedure that insanely times out every single time it's called from
We have a number of stored procedures in production that we would like to
It's simple - is there a way to use this lib to call stored
We have a SQL Server DB with 150-200 stored procs, all of which produce
Given the fact that a Java EE application is to develop, which has the
When I call ensureIndex from the mongo shell on a collection for a compound

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.