Board index » delphi » TBDEDataset.Locate in TQuery too slow.

TBDEDataset.Locate in TQuery too slow.

TBDEDataset.locate is susbstantially slower than TTable.FindKey.

I am looking for a replacement for the locate function which uses
the indexes in the query and is therefore faster.

Because of the complexity of the code we cannot re-engineer therefore
need to just be able to overwrite the locate function.

Thanks in advance,
John.

 

Re:TBDEDataset.Locate in TQuery too slow.


Reshmi,

   Use a Where clause in the SQL to find the record you want.  Selecting all
the records, and then trying to locate/findkey will be significantly slower.

Good luck,
krf

Quote
Reshmi Iyer wrote in message <3a62f969_2@dnews>...
>TBDEDataset.locate is susbstantially slower than TTable.FindKey.

>I am looking for a replacement for the locate function which uses
>the indexes in the query and is therefore faster.

>Because of the complexity of the code we cannot re-engineer therefore
>need to just be able to overwrite the locate function.

>Thanks in advance,
>John.

Re:TBDEDataset.Locate in TQuery too slow.


Thanks for your suggestion.

Unfortunately, we use the TQuery to fill grids so we cannot
just return one record in the result set.

The query has to support the user scrolling through the grid
and say moving straight to the bottom.

Whilst I'd like to be able to re-design things we do not have
the time.

If we could redesign the locate method to be more efficient
this would solve our problem.

We are willing to buy in consultancy for this problem if anyone
can recommend anyone who has a good knowledge of the BDE and SQL
Servers.

Quote
Kevin Frevert wrote in message <3a6301d9$1_2@dnews>...
>Reshmi,

>   Use a Where clause in the SQL to find the record you want.  Selecting
all
>the records, and then trying to locate/findkey will be significantly
slower.

>Good luck,
>krf

>Reshmi Iyer wrote in message <3a62f969_2@dnews>...
>>TBDEDataset.locate is susbstantially slower than TTable.FindKey.

>>I am looking for a replacement for the locate function which uses
>>the indexes in the query and is therefore faster.

>>Because of the complexity of the code we cannot re-engineer therefore
>>need to just be able to overwrite the locate function.

>>Thanks in advance,
>>John.

Re:TBDEDataset.Locate in TQuery too slow.


Against which SQL Database are you executing the query ?

Using Locate against a result set from a TQuery must initially fetch each
record from the result set sequentially until it finds a matching record.
Once this has been done all records up to that point are cached on the
client and after this Locate should work well.

Perhaps you could try pre-caching all of the data by going to the last
record in the query before the user sees the results, but I don't know how
this will affect your performance.

Generally it is up to the database which indexes to use.

Quote
"Reshmi Iyer" <reshmi.i...@capitaes.co.uk> wrote in message

news:3a62f969_2@dnews...
Quote
> TBDEDataset.locate is susbstantially slower than TTable.FindKey.

> I am looking for a replacement for the locate function which uses
> the indexes in the query and is therefore faster.

> Because of the complexity of the code we cannot re-engineer therefore
> need to just be able to overwrite the locate function.

> Thanks in advance,
> John.

Re:TBDEDataset.Locate in TQuery too slow.


The database is SQL Anywhere.

We are using grids in our app. which we refresh after a user adds a record.

We then need to reposition on the newly added record. Locate is just too
slow.

TTable.FindKey is very fast.

Are there any BDE calls we can make to move to the record quickly.

I could determine the releative position of the record in the record set
with some SQL.
Is there then some BDE call I can make to move to that record directly
without loading
all the others???

I know there are other ways of getting around this but we really need a
solution that
requires little change to our 'monster' app which is already costly to
maintain.

Quote
Andrew Flowers wrote in message <941tfk$g...@bornews.inprise.com>...
>Against which SQL Database are you executing the query ?

>Using Locate against a result set from a TQuery must initially fetch each
>record from the result set sequentially until it finds a matching record.
>Once this has been done all records up to that point are cached on the
>client and after this Locate should work well.

>Perhaps you could try pre-caching all of the data by going to the last
>record in the query before the user sees the results, but I don't know how
>this will affect your performance.

>Generally it is up to the database which indexes to use.

>"Reshmi Iyer" <reshmi.i...@capitaes.co.uk> wrote in message
>news:3a62f969_2@dnews...
>> TBDEDataset.locate is susbstantially slower than TTable.FindKey.

>> I am looking for a replacement for the locate function which uses
>> the indexes in the query and is therefore faster.

>> Because of the complexity of the code we cannot re-engineer therefore
>> need to just be able to overwrite the locate function.

>> Thanks in advance,
>> John.

Re:TBDEDataset.Locate in TQuery too slow.


Reshmi,

   A re-design would be the better solution, but since you don't have the
time, you may ask someone in the delphi.jobs forum.  There are A LOT of
eager developers willing to take on your task (for a fee, of course).

Good luck,
krf

Quote
Reshmi Iyer wrote in message <3a643786_2@dnews>...
>Thanks for your suggestion.

>Unfortunately, we use the TQuery to fill grids so we cannot
>just return one record in the result set.

>The query has to support the user scrolling through the grid
>and say moving straight to the bottom.

>Whilst I'd like to be able to re-design things we do not have
>the time.

>If we could redesign the locate method to be more efficient
>this would solve our problem.

>We are willing to buy in consultancy for this problem if anyone
>can recommend anyone who has a good knowledge of the BDE and SQL
>Servers.

Other Threads