Guys I have beginners mysql/php question.
I'm having 3 services that "collaborate" for UUID generation. Service3 receives unique requests from unique users, and gives them unique IDs(UUID) from DB. Users represent their companies, and I can't allow by any chance two IDs in one company.Service2 must know when the level of free UUID in DB is too low. Then, I am having Service1 (Node.js) which takes request from Service2 and gives a package of UUIDs(JSON) as a response. Then Service2 saves them to database if the level of UUIDs in DB is too low (too low means, the level equals to incoming UUID package, same number of UUIDs).
UUIDs are in one table and the requests become too slow when there are millions of UUIDs. How can I prevent duplicates/collisions efficiently when I'm working with bigger numbers. Hope I was clear.
EDIT: I made it unique but, when I run "SELECT ..." to check if there are duplicates, it takes too long to check millions of rows.