At 09:18 AM 6/26/2007, [EMAIL PROTECTED] wrote: >i have an app that has to update two table with pdf files from >directories. There are about 900 files in one Dir and about 3000 in the >other. I have to check if each file is in the table if not add it. This >requires 3000 searches on the table but as the app progresses it slows >down to a crawl. Anybody have any ideas?. > >I have to add to this the revers for deleted files, so I really could do >with speeding up the loop.
First try creating an index for that field in the database. Second, try reading the whole list into memory. 3000 files (or 3000 records) is a very small number given today's memory capacities. Even yesterday's memory capacities. Even 10 times that number is small. So, I would query the whole into a memory structure that you could search such as a TCollection. You could also do the same for the directory contents. Then its just a matter of using a variation on TCollection.IndexOf to see if one entry is in the other collection. _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

