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 8411469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:25:49+00:00 2026-06-10T00:25:49+00:00

I have a simple SELECT statement with a couple columns referenced in the WHERE

  • 0

I have a simple SELECT statement with a couple columns referenced in the WHERE clause. Normally I do these simple ones in the VB code (setup a Command object, set Command Type to text, set Command Text to the Select statement). However I’m seeing timeout problems. We’ve optimized just about everything we can with our tables, etc.

I’m wondering if there’d be a big performance hit just because I’m doing the query this way, versus creating a simple stored procedure with a couple params. I’m thinking maybe the inline code forces SQL to do extra work compiling, creating query plan, etc. which wouldn’t occur if I used a stored procedure.

An example of the actual SQL being run:

SELECT TOP 1 * FROM MyTable WHERE Field1 = @Field1 ORDER BY ID DESC
  • 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-06-10T00:25:50+00:00Added an answer on June 10, 2026 at 12:25 am

    A well formed “inline” or “ad-hoc” SQL query – if properly used with parameters – is just as good as a stored procedure.

    But this is absolutely crucial: you must use properly parametrized queries! If you don’t – if you concatenate together your SQL for each request – then you don’t benefit from these points…

    Just like with a stored procedure, upon first executing, a query execution plan must be found – and then that execution plan is cached in the plan cache – just like with a stored procedure.

    That query plan is reused over and over again, if you call your inline parametrized SQL statement multiple times – and the “inline” SQL query plan is subject to the same cache eviction policies as the execution plan of a stored procedure.

    Just from that point of view – if you really use properly parametrized queries – there’s no performance benefit for a stored procedure.

    Stored procedures have other benefits (like being a “security boundary” etc.), but just raw performance isn’t one of their major plus points.

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

Sidebar

Related Questions

I'm writing code using Oracle SQL Developer. I have a simple select statement that
I have the following simple select statement : select 'hello' || '|' || 'world'
I have this very simple sql statement: SELECT max_dose FROM psychotropes WHERE (patient_meds.psychotrope =
I have the following PHP code doing a very simple select into a table.
I have an Exec SQL Task that runs a simple select statement but is
I have a fairly simple SQL statement to get some results from a couple
I have this simple SQL statement: select Expr1.value - Expr2.value FROM (SELECT Expr1 =
I have this simple MySQL statement: SELECT ((AVG(q1) + AVG(q8) + AVG(q15)) / 3
I have a sql function that does a simple sql select statement: CREATE OR
I have a sqldatasource with a very simple select statement that should always return

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.