Subject Re: Relation among 3 files running slowly
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Fri, 24 Jul 2015 14:56:36 -0700
Newsgroups dbase.getting-started

On 7/24/2015 12:53 PM, BobM wrote:
> A fairly straightforward operation is running very slowly, no idea why.  Looking for suggestions!
>
> I have three dbase files, one fairly large: "A" with 1.5 million records, file "B" with 1,000 records; and file "C" with 1,000 records.  Want to replace values in file A with a ratio of other items in A, B, and C.  All key values are unique.
>
> Here's what I am doing:
>
> Select a
> use file_A
> Select  b
> use file_B exclusive
> index on key1 tag key1
> set order to key1
> Select c
> use file_C exclusive
> index on key2 tag key2
> set order to key2
> select b
> set relation to key2 into C
> select a
> set relation to key1 into B
>
> repl all field1 with field2 * (b->field1/b->field2) * c->field3
>
> I expected this to take minutes or hours but after 2 days it was still running.
>
> I am running dBase 9 plus; OS is Windows 8.1, 64 bit, 2.4 GHZ; 16GB RAM; files are stored on a 500GB SSD.
>
> Any ideas where the slowdown might be coming from?

I responded to this in another group.

Add "reindex" at the end of the replace command. This tells dBASE to
hold off rebuilding the index for the table until the whole set has been
replaced. Otherwise for every record the index is rebuilt -- slowing
things down horribly.

Ken


--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#dUFLP
dBASE Books: http://www.goldenstag.net/dbase/dBASEBooks.htm