On 2003-01-27, at 00.00, D. Richard Hipp wrote:

> Enterprise scale database engines do a more sophisticated job
> of selecting indices (when there is a choice like this) by
> collecting lots of statistics on the indices and using complex
> algorithms to make the choice.  SQLite takes the easy way out
> and makes an arbitrary choice.  With SQLite, it is up to you,
> the query author, to select an appropriate index when the choice
> of indices might make a difference.  You can disable the other
> index by modifying the WHERE clause.  To disable the I1A index,
> rewrite the WHERE clause like this:
>
>       SELECT * FROM t1 WHERE a+0=5 AND b='xyzzy';
>
> To disable the I1B index you could write
>
>       SELECT * FROM t1 WHERE a=5 AND b LIKE 'xyzzy';
>
> I should probably write some documentation talking about this
> and put it on the website....

This statement to disable I1B, however, is not likely exactly correct since
(according to the docs) LIKE is case- *insensitive*, so it would match 'XYZZY'
and 'XyZzY' as well (but not 'PLUGH' or 'PLOVER' :-).  Using GLOB instead of
LIKE should work as intended:

        SELECT * FROM t1 WHERE a=5 AND b GLOB 'xyzzy';

Derrell

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to