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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:12:49+00:00 2026-05-14T05:12:49+00:00

How does SQL Server determine whether a table column has low cardinality? The reason

  • 0

How does SQL Server determine whether a table column has low cardinality?

The reason I ask is because query optimizer would most probably not use an index on a gender column (values ‘m’ and ‘f’). However how would it determine the cardinality of the gender column to come to that decision?

On top of this, if in the unlikely event that I had a million entries in my table and only one entry in the gender column was ‘m’, would SQL server be able to determine this and use the index to retrieve that single row? Or would it just know there are only 2 distinct values in the column and not use the index?

I appreciate the above discusses some poor db design, but I’m just trying to understand how query optimizer comes to its decisions.

Many thanks.

  • 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-14T05:12:49+00:00Added an answer on May 14, 2026 at 5:12 am

    See Statistics Used by the Query Optimizer in Microsoft SQL Server 2005 .

    With 1 value ‘m’ and 999999 ‘f’ the statistics will give a cardinality estimate of 1 for ‘m’, and something close to 1M for ‘f’. But that whether the index will be used or not, there are more factors.

    In general such a low selectivity column does not make sense on an index alone. However, it does make sense as a leftmost column on a more complex index, and even as a leftmost column on the clustered index. And even if a column would make sense for ‘m’ and not for ‘f’, the query auto-parametrization may play a trick on you and generate a plan for a variable @gender instead.

    You’ll have to either read more or give more details. Some good resources are the QO team and team members blogs:

    • QO team blog
    • Conor Cunningham blog
    • Craig Friedman blog
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 494k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Cases: You want to know how daa has changed in… May 16, 2026 at 11:02 am
  • Editorial Team
    Editorial Team added an answer .container img { display: block; margin: 0 auto; } May 16, 2026 at 11:02 am
  • Editorial Team
    Editorial Team added an answer One option I found is to use a temporary table:… May 16, 2026 at 11:02 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a table in a SQL Server 2008 database. This table has a
Does SQL Server 2008 have a built in debugger? I've got a stored procedure
I know this is similar to this question , but I'm using SQL Server
I have a c# Visual Studio app. I connected to an existing SQL Server
Does anyone know of a way to determine if a image stream is in
Does anyone know where I can find a list of supported features for SQL
I have a SQL Server 2000 database instance that is rarely updated. I also
I am trying to determine the performance of a piece of generated SQL that
I use SQL Server 2008 I use a CHECK CONSTRAINT on multiple columns in
Diagrams created with Microsoft SQL Server Management Studio have their default schema set to

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.