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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:43:22+00:00 2026-05-11T16:43:22+00:00

By definition (at least from what I’ve seen) sargable means that a query is

  • 0

By definition (at least from what I’ve seen) sargable means that a query is capable of having the query engine optimize the execution plan that the query uses. I’ve tried looking up the answers, but there doesn’t seem to be a lot on the subject matter. So the question is, what does or doesn’t make an SQL query sargable? Any documentation would be greatly appreciated.

For reference: Sargable

  • 1 1 Answer
  • 1 View
  • 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-11T16:43:22+00:00Added an answer on May 11, 2026 at 4:43 pm

    The most common thing that will make a query non-sargable is to include a field inside a function in the where clause:

    SELECT ... FROM ...
    WHERE Year(myDate) = 2008
    

    The SQL optimizer can’t use an index on myDate, even if one exists. It will literally have to evaluate this function for every row of the table. Much better to use:

    WHERE myDate >= '01-01-2008' AND myDate < '01-01-2009'
    

    Some other examples:

    Bad: Select ... WHERE isNull(FullName,'Ed Jones') = 'Ed Jones'
    Fixed: Select ... WHERE ((FullName = 'Ed Jones') OR (FullName IS NULL))
    
    Bad: Select ... WHERE SUBSTRING(DealerName,4) = 'Ford'
    Fixed: Select ... WHERE DealerName Like 'Ford%'
    
    Bad: Select ... WHERE DateDiff(mm,OrderDate,GetDate()) >= 30
    Fixed: Select ... WHERE OrderDate < DateAdd(mm,-30,GetDate()) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble using python function decorators in Google's AppEngine. I'm not that familiar
I have read that decoding the potentially long string which can be returned from
I know that calling a virtual method from a base class constructor can be
I'm having no end of trouble calling MsiEnumRelatedProducts from C#. I've tried a couple
I'm using PHPs create_function($args, $code) function to dynamically load a function definition from a
Definition of SUCCEEDED(): #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) Background: When an Ok button is
The definition I found for the blueprint css class called .column says: .column Use
The definition of AudioBufferList looks weird to me… i guess my C is not
In this MySQL table definition: CREATE TABLE groups ( ug_main_grp_id smallint NOT NULL default
Below is the definition of sockaddr_storage structure ( rfc2553 ). According rfc2553, the sockaddr_storage

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.