Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Indexing on Gender column

Author  Topic 

ElCapitan
Starting Member

28 Posts

Posted - 2009-04-15 : 04:19:15
Hi all,
I understand from my reading that putting an Index on a Gender column is not a good idea because of its inherent low cardinality. So a membership system may carry equal number of male to female members; 50% each (ish).

However, if I wanted to list the first 100 MALE members, without an index on the Gender column the sql engine would have to start from the first record wether it is male or female and start searching with a table scan.

If we have an index on the gender column the sql engine can skip the first 5 million records (ish) because they are all female and go straight to the male records. Of course, in practice the male and female members would have been entered in randomly anyway so there will only be a few records of female to skip before a male record will be found. Nonetheless, in the above example, is it a valid case for an index on gender so that 5 million records can be skipped?

I am just getting a better understanding of implementing the correct indexes.

Thanks for your time.

dsindo
Starting Member

45 Posts

Posted - 2009-04-15 : 14:46:07
If you already have a clustered index, you should add an index on the gender column if you ever specify gender on any
of you 'Where' clauses.

Go to Top of Page
   

- Advertisement -