What is the most efficient way to store each users' matches in a matchmaking app/website? Given the complexity of these kind of algorithms, is it reasonable to calculate the matches all the time, on-the-fly, when a user logs-in or presses the search button and later ignore the results after they have left? If that's not okay for a reasonably large app, then storing all the matches for each user can be a challenge also, if there are more than a few million registered users.Is narrowing the potential matches, like max. 100 matches per user or search only between users who live in this city, is the way to go or are there better ways to get full match results and store it for every user?Also how would one design a database structure for storing the results? A NoSQL document that stores anyone's matches in their own document or just a relational table that stores two users' match percentage in a single record and repeats it for all the matches?Update How matchmaking algorithm works: If we say A, B and C are all users, it would first calculates how much B's answers and preferences satisfies A, then it would calculate how much A's answers satisfies B, then gets the geometric mean of these two numbers, which is then marked as the actual match percentage between A  and B. Then it would repeat this for A and C and then B and C.
How should a matchmaking app store matches for each user?
database