Answer the question
In order to leave comments, you need to log in
How to effectively store "connectivity" between users?
Greetings!
There is an algorithm that calculates an indicator (number) that characterizes the relationship of user A to user B.
The algorithm is transitive, symmetric, i.e. A->B = B->A.
As the number of users grows, it will be necessary to store the results and recalculate them (for example, if some parameters of user A change, it is necessary to recalculate its relation to all others).
The question arises, how to efficiently store, quickly update and read such data? SQL, NoSQL? Which engine/base is best? After all, there will already be 1,000,000 records for 1,000 users.
Thank you!
Answer the question
In order to leave comments, you need to log in
NoSQL?You just said that this setting has two dependencies. NoSQL is not a choice.
After all, there will already be 1,000,000 records for 1,000 users.First, it won't: not all of these users will have connections.
If the algorithm specifies a metric, and are willing to sacrifice accuracy, it is possible to map all users into an O(log n)-dimensional space. In the worst case, the distances will deteriorate into O(log n), but only O(n log n) bits of information can be stored.
Do you really need to keep this number for everyone? If only for those who have it less / more than a certain threshold, then this is O (N) or O (NlogN), which will already fit into regular SQL, and not O (N ^ 2), which is really bad.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question