Subject Re: [IBO] Problem with: IB_Query with order by ... COLLATE
Author Luiz
José,

You could try create a domain to column des as:

CREATE DOMAIN DOM_DES VARCHAR( 80 )
COLLATE ES_ES

and define your column des as DOM_DES.

After this, create your index on (cod,des)

I don't tested, but I believe can to do some difference.

Luiz.
----- Original Message -----
From: "pepmallorca" <pepmallorca@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, March 01, 2002 2:25 PM
Subject: [IBO] Problem with: IB_Query with order by ... COLLATE


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é,