keepingbusy
Programmer
Hi
We have a process that carries out the following:
There are two tables that store information that has been imported from txt files. One table contains current information (Today) and the other contains previous information (Yesterday).
On a daily basis, new information is imported into the current table and the current tables data is sent to yesterdays table depending on conditions.
These conditions include a match on a unique number (called an SKU number) and also whether or not the price is < the previous one.
We have some code below which does the job perfectly and when you process about 68000 records in the tables, it takes about 30 minutes.
However, when the table increase to over 200,000 we are now talking many hours to process (this is done overnight but not really the best way to do it).
I am looking for some suggestions (not the sollution) on how to speed this up.
To try and simplify things, TODAY stores the SELL price and SKU number, it then looks for it in TPREVIOUS (Yesterdays data) and if it finds a match, deletes the record. Here is what we have so far:
Code:
USE TODAY && CURRENT / NEW LIST
GO TOP
DO WHILE NOT EOF()
mrecno=0
mrecno=RECNO()
STORE " " TO mdelete
STORE SPACE(15) TO mcolumn5
STORE SPACE(16) TO mcolumn6
STORE SELL TO mcolumn5
STORE SKU TO mcolumn6
* NOW START A SEARCH TO SEE IF TODAY SKU NUMBER
* AND PRICE MATCH THAT OF YESTERDAYS
* IF IT DOES, DELETE IT FROM CURRENT
USE TPREVIOUS
GO TOP
LOCATE FOR ALLTRIM(COLUMN5)=ALLTRIM(mcolumn5) ;
AND ALLTRIM(COLUMN6)=ALLTRIM(mcolumn6)
* IF WE FIND A MATCH IN THE CURRENT TABLE
* THAT WAS IN YESTERDAYS, DELETE IT
IF FOUND()
REPLACE DELETEIT WITH "Y"
STORE "Y" TO mdelete
ENDI
CLOSE DATABASES
USE TODAY SHARED
GO mrecno
IF mdelete="Y"
REPLACE DELETEIT WITH "Y"
ENDI
SKIP
ENDDO
Many thanks