Subject Re: [firebird-support] Re: Composite index question
Author Svein Erling Tysvaer
nz_fbsup wrote:
>>> CREATE INDEX IDX_1 ON T (Foo DESC)
>> No it didn't ;)
>
> Yes, it`s my typos, sorry. :)
>
>> You are using a query without a where clause. The optimiser thinks it
>> is quicker to read the data into memory
>
> Ok, but what is the 'where' (or PLAN?) clause that will "force" using
> individual ('desc foo', and 'asc bar') indexes?

You could try something like
'where foo < 999999999 and bar > -999999999', where the numbers are
higher/lower than the maximum existing value (and no fields are null).
But my guess is that this will slow down the query rather than speed it
up (the optimizer is often right in its suggestions, and NATURAL may be
quicker than to use indexes when you have no WHERE clause limiting which
rows to return).

Set