Subject Re: [firebird-support] Re: Order Clause Tunning Problem
Author Aage Johansen
kick_tisho wrote:
> ...
> I search i way to make it in one query. My purpose is to use the index
> so later i can make tests to see what is faster. I think with the
> index will be many times faster.


I would have tested this ...

Assuming NAME is char/varchar and LASTUPDATED is date/datetime -
Try:
select NAME
from CONTACTS
order by NAME
and
select NAME
from CONTACTS
order by NAME||''

And maybe this as well:
select LASTUPDATED
from CONTACTS
order by LASTUPDATED
and
select LASTUPDATED
from CONTACTS
order by LASTUPDATED+0

The concatenation (||) or addition will force a sort. Is there a big
difference between sorting and using an index?

(
With Fb before 1.5 you may have to do:
select NAME||''
from CONTACTS
order by 1
and
select LASTUPDATED+0
from CONTACTS
order by 1

)

--
Aage J.