in reply to Querying databases in a loop

There's a good pattern I got from the wonderful Dragonfly book accidentally called "Oracle Design". When you have lots of tables of identical structure (log archives come to mind in addition to what you have), use SQL UNION clause to search them all at once. Of course, MySQL won't let you create a VIEW, so you'll probably have a biiiig SQL statement.