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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:19:57+00:00 2026-05-14T03:19:57+00:00

I have recently discovered the ability to use WHERE clauses within indexes in SQL

  • 0

I have recently discovered the ability to use WHERE clauses within indexes in SQL Server 2005. I would like to optimize some queries, and was hoping to get some feedback.

The table of interest contains 2 float columns, [long] and [short]. These columns could be 0 in 20-40% of rows. There are several stored procs that query this table with one of the following clauses:

  • WHERE (long <> 0 OR short <> 0)
  • WHERE (long <> 0 AND short <> 0)

I am considering putting indexes on long and short (or one index on both) with the condition WHERE <> 0 in the hopes that the stored procs will be able to use an index scan rather than a table scan to grab this data.

Given the above info, how would you go about creating indexes? Or, if an index isn’t the best solution, what are reasonable alternatives? Thanks in advance.

  • 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-14T03:19:57+00:00Added an answer on May 14, 2026 at 3:19 am

    Using Where clauses in an index creation is a SQL Server 2008 feature – Filtered indexes are not within SQL Server 2005.

    Filtered Indexes follow the same rules about tipping as normal NC, non-covering indexes, so with 60-80% of the rows being <> 0, the likelihood is that the index will tip to a table / clustered index scan.

    The only way to avoid that tipping is to make the index covering, but we can not see the rest of the clause / selection to know whether that is a reasonable option.

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

Sidebar

Related Questions

I have recently discovered the tablediff utility of SQL Server 2005. I have 2
I have discovered recently that's possible to call anoymous blocks from jdbc like this:
I have recently discovered an annoying problem in some large program i am developing;
I recently discovered some of the power and easy of use of dired mode
I have recently discovered LINQ and I find it very interesting to use. Currently
I have recently discovered that when I have pointers within a class, I need
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
I recently discovered that when you have a page set to session readonly and
I have just recently discovered the difference between different constructors in GDI+. Going: var
I've recently discovered that MVC is supposed to have two different flavors, model one

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.