Re: order by
Posted in 2000
--- =?windows-1257?B?VmxhZGltaXIgUvxudPw=?= <vlads@kredinfo.ee>
> wrote:
>
>Hello!
>
>I have Informix Online 7.2 running on SCO OpenServer 5
>
>Query
>
>SELECT * FROM seosed
>WHERE onimi MATCHES "*LIISING*">
>takes about 3 seconds to complete.
>and the resultset contains about 50 records.
>Table seosed contains about 100 000 records
>
>but
>
>SELECT * FROM seosed
>WHERE onimi MATCHES "*LIISING*"
>ORDER BY onimi>
>takes about 15 minutes. What should I do
>to make this query complete quicker?
If you're displaying to the screen, your first query will return rows as soon as there are enough to fill the screen (in dbaccess or a form). The second one has to sort all rows before it can begin to display any. It may be that both querys take quite awhile but the first one seems faster because it begins displaying fairly quickly. A MATCHES with wild cards at the beginning and end just takes longer as a rule.
Just for kicks, you might try selecting using your first query into a temp_table and then
SELECT * FROM temp_table
ORDER BY onimi
That way your ORDER can begin immediately since there is no WHERE clause to deal with. My guess is that it won't help much though since were still dealing with the wild cards in MATCHES.
==
Maintainer of the procrastinator's FAQ. Well, maybe tomorrow I will be.
_____________________________________________________________
Want a new web-based email account ? ---> http://www.firstlinux.net