in reply to Replacing SQL with perl
On one script that used to take over two days to run, I got it running in under two hours by among other things, reading in some of the smaller static tables (< 50,000 rows - hey, I had the memory!) into hash arrays, then using the hash arrays instead of repeatedly querying the database. This was strictly to look things up by primary key, it was not to search/scan fields using wildcards or to let perl do any ordering. So sometimes it is worthwhile to read entire tables into memory depending on what you're trying to accomplish.