Subject | Re: [firebird-support] Re: Order Clause Tunning Problem |
---|---|
Author | Aage Johansen |
Post date | 2005-05-25T20:36:48Z |
kick_tisho wrote:
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.
> ...I would have tested this ...
> 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.
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.