Subject Re: Limiting fetched rows doesn't offer much performance benefit
Author jimbehr3446
--- In firebird-support@yahoogroups.com, "Ivan Prenosil"
<Ivan.Prenosil@...> wrote:
>
> Since you use only one field in WHERE clause, adding another field
to the index
> can't speed up SELECT statement. Your problem is that either
> - there are really too much 'Y' values in FALG field (thus dropping
the index should help),
>
Sometimes there are millions of records with FLAG="Y" and sometimes
only a few. As you point out, the index is not needed when a large
percentage of the records have FLAG="Y". But when there are only a
few it saves searching sequentially for that one-in-a-million record.

>
> or
> - you have incorrect order of fields in index' definition, it must
be (FLAG, PK), not (PK, FLAG)
>
I wish it were that easy. We have (FLAG, PK) :-(