I ran across this problem as well. Checking a blog with 108k comments, I needed to check them against the spam database but knew there would be legit comments mixed in so I didn’t want to just delete them all. Instead, I put a limit statement in the askimet.php function.
So in akismet_recheck_queue() I added the Limit below. Tweak the number for what your server can handle…
$moderation = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0' LIMIT 1000" , ARRAY_A );