Batch API to process millions of records
Add a column for 'processed'. Each time you run the batch process select rows with a limit of 100 unprocessed rows for you batch process and then mark each row as processed.  

You could run this on cron or something or run a nested batch.