Best (Speed) changing order by for a lookup
Posted on 2001-07-26
Here is the setup:
D5 Ent w/IP 3000 components, Interbase 6.01, Two Tiered application.
Here is the question:
I need to be able to have a table searched by any one of 6 different fields. I am using a TwwIncrementalSearch field and a TwwDBGrid. No problems yet. I have a TQuery, to a TDataSetProvider, to a TwwClientDataSet.
A) Change the SQL string in the query and close/open the CDS.
B) Create 6 IndexDefs for the CDS and swith them as needed, which would also require an close/open.
C) Not sure if it is possible, but put a variable in the SQL "order by :FieldName" or "order by @FieldName", but this also would require a close/open, and therefore a re-execution of my query.
These options all seem to slow, which would be OK in a smalish dataset, but in this case I'm looking for ideas as I expect this table to grow quickly.
Who has a good alternative, or which of the above to feel is the best alternative?