Subject Problem with: IB_Query with order by ... COLLATE
Author pepmallorca
Hello:

I have a problem with IBQUERY, SORT and COLLATES. I think this
problem is relationed with IBOBJECTS. If finally is a general
problem of Interbase, sorry for that.


The simplified problem is the next:

I have a table:

TBL(cod,des)

cod varchar(3)
des varchar(80)

For the condition cod='x', the table has 180.000 records

I want to show this information in a grid (IB_Query) ordering by the
combination (cod,des).

To increase speed I have an index like: ON TBL(cod,des)

If the Query is:

select cod,des from TBL order by cod,des

<the result is shown in a second, and if you want, you can go to the
last record in a second ==> ''OK'' >

But, I NEED the query like this:

select cod,des from TBL order by cod,des COLLATE ES_ES

It works, but spends a more than 1 minute to give the first result to
the user, and if you try to go to the last record (spends more time
FETCHING RESULTS).

=====

If can helps someone to solve the problem, the PLAN SORT in the 2
cases are the next:


1) order by cod,des
PLAN (TBL ORDER index1) ===> OK

2) order by cod,des collate es_es
PLAN SORT ((TBL NATURAL))
or if I use a condition cod='x' : PLAN SORT ((TBL INDEX (index1)))


In the second case (WHICH I NEED), I think the problem is that always
finishes doing a PLAN SORT.

=====

Any solution for this problem? Maybe using the ORDERING option to
IB_Query....??

I hope someone can helps me.



Thanks,

José,