Process licenses in batches of 1000 to avoid loading the entire database into memory.