I had a Delphi 4 program that I developed many years ago that used Opus DirectAccess to search the Microsoft Access database sequentially and retrieve the desired records. Delphi 4 did not have ADO, so I used DirectAccess.
But now I upgraded to Delphi 2009 and converted the program to use ADO. I found that a cycle through a table (about 100,000 records) starts as fast as in DirectAccess, but then it starts to slow down and becomes slower and slower when it goes through the table. The main loop:
ArticlesTable.First;
while not Cancel and not ArticlesTable.Eof do begin
( See if the current record has criteria desired )
( If so, process the record )
ArticlesTable.Next;
end;
Basically, it's just processing records sequentially using the .Next method.
So why is this slowing down, and how can I recode this so that it doesn't slow down?
source
share