Hello,

I am using neo4j as database in my website. I am having problem in deciding
best way to query the database.

An user buys, lets say pen, from a shop. User and shop are the nodes and pen
is also a node . Relationships are like

User1->buysfrom->shop1
User1->uses->pen
buysfrom and uses are relationships.

Now I want to find all other users who buy pen from shop1.
Some ways which I have thought to get the result.

I start from user1 and move to shop1 node and from there I find all nodes
with relationship buysfrom incoming to shop1.
But it will give me all nodes who buys different stuff than pen. In that
case I have to check all the hits if they uses pen by traversing from user
to pen node if such relationship exist this user is my answer.
In my use case if they use pen then they buy from shop1 thats for sure.


Another way I can put an attribute pen in relationship buysfrom and index
relationship using that attribute. But this will give me all the user who
buys pen from all the shops. Again lots of checking have to de done again
like for every hit I have to check if shop1 is end node of the hit If yes
then start node is the answer I need.

Now I need advice if above mentioned schemes are any good and doubts which I
have regarding them are genuine or not?
I am expecting minimum 40-50k users and lots of reads and writes in my
system.

I am sorry if this is a very big question at once but I am thinking a lot
over these algos for past 1 month  and need some advice how neo4j handles
these things.
-- 
Manav Goel
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to