"Alexander Newald" <alexander@stripped> wrote on 23/09/2004 19:28:09:
> >
> > Does
> > select count(id) from test where id like "d%" ;
> > work any better? I would expect it to make better use of the index.
> >
> > Alec
> >
>
> Hello,
>
> yes it works better for sets of data with very few lines with an id
starting
> with d. But it takes even longer when more lines are involved.
>
> I thought using an index will "know" the result??
It is not obvious that the index can look "inside" the LEFT() function, so
that MySQL has to submit all records to LEFT() and check the results. Why
it gets slow when you have many LIKE "d%" I cannot understand.
Alec