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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:37:38+00:00 2026-05-13T23:37:38+00:00

I have a general question about the way that database indexing works, particularly in

  • 0

I have a general question about the way that database indexing works, particularly in mysql. Let’s say I have a table with a million rows with a column “ClientID” that is distributed relatively equally among 30 values. Thus, this column is very low cardinality (30) relative to the primary key (1 million).

Now, I understand that you shouldn’t create indexes on low cardinality fields. However, in this case, queries are only ever done with one of the 30 clientIDs. Thus, wouldn’t creating an index on ClientID be helpful, as the search space is automatically reduced to 1/30th what it normally would be? Or is my understanding of how the index works flawed?

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-13T23:37:39+00:00Added an answer on May 13, 2026 at 11:37 pm

    What I’ve learned as a very general rule of thumb from the MySQL-sponsored seminars I’ve attended is that you gain SOME level of performance benefit in most cases where the cardinality reduces your search space by 80% or more. This seems to hold across just about any hardware setup I’ve encountered.

    This looks like an index you would almost certainly benefit from. Of course, this can quickly break down on a heavy-write table where the index constantly needs to be adjusted.

    In other circumstances, the proper answer is really ‘it depends’, and benchmarking is usually the way to go.

    You may also want to check the BENCHMARK() function in mysql – it’s not perfect but can help in testing things like this: http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_benchmark

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

Sidebar

Related Questions

A general architecture question in Sitecore 6... Let’s say we have a situation where
I have a MySQL table with utf8 general ci collation. In the table, I
Ok another WPF question, well I guess this is just general .NET. I have
Yesterday I asked this general question about decimals and their internal precisions. Here is
This is a general question about how limiting are web development frameworks such as
This is more of a general question about which direction would be a better
I have a general IO question. I was trying to replace a single line
Ok this is more of general technology/approach question. We have a very simple web
I have a general exception handler, Application_error in my global.asax where I'm trying to
I've done some research into server push with javascript and have found the general

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.