Subject | Re: one performance/index question |
---|---|
Author | Sasa Mihajlovic |
Post date | 2009-02-03T11:02Z |
Hi,
Thanks Ann for help. I was created a lot of index like this and
Firebird is use that indexes, just only in database statistics it is
reported like "bad" indexes. That is main reason why I was
in "trouble"!
--- In firebird-support@yahoogroups.com, "Ann W. Harrison"
<aharrison@...> wrote:
Thanks Ann for help. I was created a lot of index like this and
Firebird is use that indexes, just only in database statistics it is
reported like "bad" indexes. That is main reason why I was
in "trouble"!
--- In firebird-support@yahoogroups.com, "Ann W. Harrison"
<aharrison@...> wrote:
>field in
> Adam wrote:
> >>
> >> ...so do I need to index that field
> >> because I have only 3-5 different values and I often use this
> >> my sql statements like very important in where clause?Indices can
> >>
> >
> > Usually such poor selectivity will make performance worse.
> > only be of benefit if they eliminate the need to read data pagesfrom
> > disk. When there are so many duplicates, the chances of beingable to
> > ignore an entire data page is reduced to near 0.
> >
>
> In this case, the index may not be so bad. Records in one year
> tend to be stored together, just because they tend to be created
> in the year that's in the field. If that's the case, the index
> will take you to the 20-30% of the pages that have relevant records.
>
> Similarly, if you have records of breast cancer patients, an index
> on gender is very useful when you're looking for males, and much
> less so when looking for females. As far as I know, an index on
> gender is no use in a database of testicular cancer patients.
>
>
> Cheers,
>
> Ann
>