Polyglot persistece with a graph database for relationships is a good ideia? -
i know if worth idea of use graph databases work relationships.
i pretend use relational database storing entities "user", "page", "comment", "post" etc.
but in cases of typical social graph based workload, have deep traversals relational not deal , involves slow joins.
example: comment -(made_in)-> post -(made_in)-> page etc...
i'm thinking make this:
example:
user id: 1
query: get followers of user_id 1
- query neo4j outcoming edges named "follows" node user id 1
with list of ids query them on users table:
select * users user_id in (ids)
is slow?
i have seen question is idea use mysql , neo4j together?, still cannot understand why correct answer says that not idea.
thanks
using neo4j great choice of technologies application yours, requires deep traversals. reason it's choice two-fold: 1 cypher language makes such queries easy. second deep traversals happen quickly, because of way data structured in database.
in order reap both of these benefits, want have both relationships , people (as nodes) in graph. you'll able friend-of-friends query follows:
start john=node:node_auto_index(name = 'john') match john-[:friend]->()-[:friend]->fof return john, fof
and friend-of-friend-of-friend query follows:
start john=node:node_auto_index(name = 'john') match john-[:friend]->()-[:friend]->()->[:friend]->fofof return john, fofof
...and on. (same idea posts , comments, replace name.)
using neo4j alongside mysql fine, wouldn't in particular way, because code more complex, , you'll lose time hopping between neo4j , mysql.
best of luck!
philip
Comments
Post a Comment