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

  • Home
  • SEARCH
  • 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 5998039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:20:57+00:00 2026-05-23T00:20:57+00:00

Possible Duplicate: What are the pros and cons to keeping SQL in Stored Procs

  • 0

Possible Duplicate:
What are the pros and cons to keeping SQL in Stored Procs versus Code

I was listening to Hanselminutes podcast “Rise of The Micro ORM,” where one of the guests (Sam Saffron and Rob Conery) outlined the classic reasons that DBA’s insist on stored procedures:

  1. They are pre-compiled, which gives them an execution speed advantage
  2. They hide the underlying database scheme, which allows a separation of interface and implementation that prevents brittleness.

A guest then said these aren’t good arguments, and suggested the real reason the DBA’s will insist on stored procs is because they simply want to protect themselves from the ignorance of the middle-tier developers.

I found that statement to be a bit on the extreme side. Certainly I can agree that argument #2 is flawed, but I thought it was well known that sending arbitrary (uncompiled) SQL to the database was a performance hit. Is there something I’m missing that would explain why argument #1 is not really true?

My own answer, as just a guess, is that there is a performance hit – but it rarely matters. It is perhaps analogous to a developer who attempts to optimize every loop he writes, even though only 1% of the loops written ever benefit from the tuning. Am I capturing the thought correctly?

  • 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-23T00:20:58+00:00Added an answer on May 23, 2026 at 12:20 am

    “but I thought it was well known that sending arbitrary (uncompiled) SQL to the database was a performance hit.”

    The distinction you’re making between stored procs and other sql statements regarding precompilation hasn’t existed since SQL 6.5.

    Stored Procedures and Execution Plans

    In SQL Server version 6.5 and earlier,
    stored procedures were a way to
    partially precompile an execution
    plan. At the time the stored procedure
    was created, a partially compiled
    execution plan was stored in a system
    table. Executing a stored procedure
    was more efficient than executing an
    SQL statement because SQL Server did
    not have to compile an execution plan
    completely, it only had to finish
    optimizing the stored plan for the
    procedure. Also, the fully compiled
    execution plan for the stored
    procedure was retained in the SQL
    Server procedure cache, meaning that
    subsequent executions of the stored
    procedure could use the precompiled
    execution plan.

    SQL Server 2000 and SQL Server version
    7.0 incorporate a number of changes to statement processing that extend many
    of the performance benefits of stored
    procedures to all SQL statements. SQL
    Server 2000 and SQL Server 7.0 do not
    save a partially compiled plan for
    stored procedures when they are
    created. A stored procedure is
    compiled at execution time, like any
    other Transact-SQL statement.
    SQL
    Server 2000 and SQL Server 7.0 retain
    execution plans for all SQL statements
    in the procedure cache, not just
    stored procedure execution plans. The
    database engine uses an efficient
    algorithm for comparing new
    Transact-SQL statements with the
    Transact-SQL statements of existing
    execution plans. If the database
    engine determines that a new
    Transact-SQL statement matches the
    Transact-SQL statement of an existing
    execution plan, it reuses the plan.
    This reduces the relative performance
    benefit of precompiling stored
    procedures by extending execution plan
    reuse to all SQL statements.

    http://msdn.microsoft.com/en-us/library/aa174792%28v=sql.80%29.aspx

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

Sidebar

Related Questions

Possible Duplicate: What are the pros and cons to keeping SQL in Stored Procs
Possible Duplicate: Pros and Cons of using SqlCommand Prepare in C#? This is what
Possible Duplicate: or is not valid C++ : why does this code compile ?
Possible Duplicate: What's the difference between a temp table and table variable in SQL
Possible Duplicate: string1 >= string2 not implemented in Linq to SQL, any workarround? To
Possible Duplicate: Howto build a SQL statement with using IDs that might not be
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions

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.