Hi!
When there are a LOT of insert commands, of course, process will speed up when you remove indexes for duration of the process. Whatch also if you have any triggrs for update in Table1 and INSERT for Table3. The logic in these triggers might also slow down the process quite a bit. Also look if you can improve algorithm so it make less steps. For example, replace scan by REPLACE ALL command and instead of
IF SEEK(Field2, "Table2", 2)
IF Table2.Field1 = .T.
INSERT INTO Table3 blah blah blah.....
ENDIF
ENDIF
use SELECT statepent to get the list, than use that list to insert records. Something like that.
>>Hi!
>>
>>As VFP do scanning, it get more and more memory for buffers. Finally its up to the swapping in HDD that cause slow down. Try to use FLUSH periodically, say, each 100 records.
>>Another reason is insert command for table with indexes. When table3 have a lot of indexes, each nex insert become slower and slower.
>
>Hi Vlad,
>
>Could you please elaborate more on this problem? Would you recommend to delete tag all and after the process is done, recreate all indexes? Say, I have a table, which I update each month. I zap the original table and use scan loop + insert into this table, which becomes 5mln. records after the process is done. The whole process takes about 30 min. on the server (I usually don't run it from my machine, because it may take up to two hours). So, what technique do you usually use to optimize scan endscan process?
>
>Thanks in advance.
>
>>
>>>....code after tables have been opened
>>>
>>>SELECT Table1
>>>SCAN
>>>REPLACE Field1 WITH FieldValue IN Table1
>>> IF SEEK(Field2, "Table2", 2)
>>> IF Table2.Field1 = .T.
>>> INSERT INTO Table3 blah blah blah.....
>>> ENDIF
>>> ENDIF
>>>ENDSCAN
>>>
>>>There you go, basically what it is doing.
>>>
>>>Kev
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.