Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

index on column with 2 possible values 1

Status
Not open for further replies.

nego78

Programmer
Jun 13, 2004
129
PL
hi

is any sense to create index on column which can have only two values ex: 1 and NULL ?

Webdesign
 
If the two values occur roughly equally often, then the query optimiser will usually ignore any index, so there is no point in having one, as it would only slow down updates. However, if one particular value predominates, then it could make sense to have an index.
 
My experience in Oracle (if applicable to MySQL) was that using a standard b-tree index on a field like that usually slowed the query down. Oracle has a "bitmap index" that handles those types of keys efficiently, but I'm not aware of a similar feature in MySQL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top