Subject slow: "select first(1) * from table where partnumber >= :search order by partnumber"
Author G. Nau
environment: Firebird server 1.5.2 on Linux (Suse 9.2), Windows
clients with IBObject 4.5.

I use the following selects to search for a single record equal or
greater than the searchstring:
"select first(1) * from table where partnumber >= :search order by
partnumber"

It's working well, but kind of slow on bigger tables (>20.000 records).
It's faster near the the of the table and very slow at the beginning
(ordered by partnumber).
While digging through the newsgroups and mailings lists, I found
somewhere that a "select first(1) ..." is internally generating the full
sort and then returning the single record.
My question:
1.) Is there a way to optimize this query?
2.) Any improvements in FB2? As there is an index on the
partnumber column, the plan should be able to return the data
quickly using it.

Regards
Gunther






___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de