"lylefair" <ly******@yahoo .ca> wrote in
news:11******** **************@ z14g2000cwz.goo glegroups.com:
From:Microsoft© Jet Database Engine Programmer's Guide
**** begin quote ****
[snip]
The first guideline is that fields containing highly duplicated
data should not be indexed (for example, fields with the Yes/No
data type, and fields that represent gender, state abbreviations,
or country codes).
I know this is the orthodoxy on this issue, but I don't follow it.
I've found in plenty of cases that sparsely-populated indexes (i.e.,
indexes with a small number of unique values) can massively speed up
selects that involve those fields. This includes Boolean fields, but
the most common case where I've encountered this is in one of the
fields I use for stamping records with data about who edited it. My
general approach is to have Created, Updated and UpdatedBy fields.
The first two are dates (with Default=Date()) , and the last a text
field that I populate from CurrentUser() or from the Windows user
name (depends on the app). UpdatedBy never has a large number of
unique values as none of my apps are being used by more than a
couple dozen unique users.
So, by the orthodox rule, you'd not index such a field.
But when I *don't* index it, my routines to retrieve and sort and
count for the user stats take much, much longer. So, I put in the
indexes, despite the logic behind the orthodox rule not to index
such fields.
And I've seen the same thing on Boolean fields.
It does seem to me, though, that fields that have lots of Null
values are not speeded up nearly as much as those where all records
have a value.
--
David W. Fenton
http://www.bway.net/~dfenton
dfenton at bway dot net
http://www.bway.net/~dfassoc