Subject | Re: Can someone explain to me what's the best way to do this? |
---|---|
Author | andrew_s_vaz |
Post date | 2004-12-01T01:19:22Z |
> >Any known way so the <like '%a'> can use an index? Or simply itAnn
> > just can't use it?
>
> One of the questions the optimizer must answer when choosing to
> use an index is whether (or not) the index is likely to make
> retrievals faster. Remember that Firebird does not store records
> in the index, but on separate data pages. The fastest way to
> read all the records in a table (by far) is to read the data
> pages. The restriction "like '%a%'" will probably return most
> of the rows in a table, so the fastest way to get the results
> is to skip the index and just read the data pages.
>
> The restriction "like '%abcdef%'" is a better candidate for an
> index lookup, but it runs into a different problem. The index
> lookup code is designed to identify a contiguous set of matches,
> not to scan the whole index, expanding the each key, checking
> for a match, and continuing. Thus it can find 'abc%' because
> that includes everything from 'abc' up to but not including
> 'abd'.
>
> The answer, for your application, may be to find a text indexing
> package for Firebird - there are some, though I don't have a
> pointer at the moment.
>
>
> Regards,
>
Thank you very much. Your answers are always very clarifying and
appreciated, as well as all the others that helped also. :-)
Thanks.
Andrew