Subject Re: [IBO] Locate on tib_query and fetchall
Author TeamIBO
> When I open a tib_query and do a locate, a fetchall is done
> (autofetchall=false). A dialog box appears saying 'fetching query
> results record ..' while it fetches the 30000 records in the table.
> This is slow, to the point of being not acceptable, especially
> compared to the bde version of the same program. The query (see
> below) uses partnumber as the order by and then as the locate field.
> This field is a unique key in the table (partid is the primary key).
> Is there anything I can do to speed up the locate? Am I doing
> something wrong? I've checked the faqs. Thanks for any help you can
> provide. (Delphi 6, IBO 4.2.fr)

> SELECT PARTNUMBER,PARTID,QTYONHAND,UOFM
> FROM TMA_PART
> ORDER BY PARTNUMBER

The first thing I would be looking at is whether you need such an open
ended query in the first place. Do you really want to cache the
entire dataset at the client or are you always looking for one
particular record? If the latter then you should be using a parameter
rather than a locate.

Or perhaps you should take a look at some of the sample apps to see
how dssSearch mode works, since this is likely to solve your problem
much more elegantly.

Given that, for some reason, you want the user to be scrolling through
the entire dataset there are a few things you can try...

* Dont use explicit ordering use orderinglinks.

* Setup the OrderingLinks so that
PARTNUMBER=ITEM=1;POS=0
to enable IBOs horizontal refinement.

* Set FetchWholeRows to false - so that only keys are being fetched,
although this may not matter much given that your records are only
small.

* Another possibility is to tell IBO that PARTNUMBER is the KeyLink.
Since you say it is unique to the dataset this should be acceptable
and I know that locate has special code to optimise key based
searches.

Try the first two options first. If they give adequate response they
are the options I would recommend. If the four fields you are
retrieving are all very small I would skip the FetchWholeRows option.
If nothing else helps try the last option.


hth

--
Geoff Worboys - TeamIBO
Telesis Computing