data modeling - How to model this[Networks, details in post] in database for efficiency and ease of use? -


On LinkedIn, when you go to a profile, you can see how you are connected to them. I believe Lincoln shows up to the third level connection if not more, then

words -> Foo users, bar users, just users -> Joel's connection -> Joel

How do I represent it in the database.

If I model,

 User ID PK name four connection user 1FK user2fk 

Then to find the network, three levels are deep, I need to get all my connections, their connections and their connections, and then see if the current user is there or not. It is obviously very inefficient with any size DB, and possibly likely to work together.

Because, on the link, I can see this network, I go to any profile, I do not think it is either accurate.

The second thing that comes to my mind is probably not the best in relational DB, but then what would be the best way to store and retrieve it?

The use of my recommended graph database is currently only one implementation available, and this is Written in Java, but there is binding for Ruby and Scala (Python is in progress).

If you do not know Java, then you probably will not be able to find something similar on any other platform (yet), unfortunately though, if you are least interested in knowing (or java) ) Know, then its properly (Technically you do not even need to learn Java due to Ruby / Python binding.) Neo4j was actually created for what you are trying to do. You are trying to implement it in a relational database Go through a ton, when you will be able to do exact similar tasks in just a few lines of Java code, and even more efficiently.

If this is not an option, then I still recommend other database types like focusing on this. Relational databases were not created for this type of thing, and you go through more pain by trying to learn it by changing it into an RDBMS in a different database.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -