Subject Re: [firebird-support] '<>' doesn't pick the index in the where clause
Author Helen Borrie
At 03:14 AM 8/11/2004 +0000, you wrote:


>Hi,
>
> The following SQL doesn't use the index:
>
> SELECT * FROM CLIENTS
> WHERE CLIENT_ID <> 1
>
> but the one below use the correct index:
>
> SELECT * FROM CLIENTS
> WHERE CLIENT_ID > 1 OR CLIENT_ID < 1
>
> How come? BTW, I'm using DB WorkBench to see the sql plans.

"not" searches don't use an index. It's always best to provide positive
search criteria if you possibly can for searches that would benefit from
using an index.

btw, indexed searches aren't necessarily faster than natural order searches.

./hb