Tested it with 3 million records in the DB and it was still too slow getting the country and domain counts. Offloaded the counting to the DB and it's at least 10x faster.