Page 1 of 1

Locate very slow when table record > 1000,000 rec

Posted: Sat 05 Apr 2008 19:57
by b_yaghobi
Hi CoreLab team

suppose you have a table with >= 1000,000

when you want to locate a record that accidental in a last last record in

your table, Locate very very slow to find this record !!!!

Example :

T1 : (Filed1, Field2, ...) (Field1 is PK)

Table Values :
1,....
2,....
3,....
4,....
.
.
.
.
1000000,...

Now :

T1.Locate('Field1', 1000,000, []) -> Very Very Slow


( Please dont tell me to use Query for found this record ! )


Thanks for your Advice and your the best of the best Packages

Locate Field1

Posted: Sun 06 Apr 2008 19:24
by Trianon
Did you specified Field1 in the IndexFieldNames property of your Dataset?

Posted: Mon 07 Apr 2008 10:31
by Antaeus
Trianon is right. Specifying Field1 in IndexFieldNames will improve performance of locate operations. This happens because SDAC builds index by fields specified in IndexFieldNames and performs the binary search using this index.

Also when you open a dataset in FetchAll=False mode, the first call to Locate will be slow because it forces fetch for all records.