Neo4J Performance Performance - Using More Nodes and Relationships

Let's say that I have 3 different types of nodes , plans, big ideas and ideas.

Now each Plan can consist of 0+ Big-Ideas and 0+ Ideas, as well as weights (votes) for these relationships. Big-Ides can also be created by Ideas.

For example, this plan A.

A -[:HAS_BIG_IDEA {Weight: 30}] -> B (Big-Idea)
A -[:HAS_IDEA {Weight: 10}] -> C (Idea)
A -[:HAS_BIG_IDEA {Weight: 1}] -> D (Big-Idea) -[:IS_MADE_OF {PlanID, Date, Weight}] -> E (Idea)

      

Plans change daily and votes are given daily. I originally decided to have 1 node for each Plan type and add new relationships daily with properties for Date and Weight . The problem is that as the number of ideas and the number of big ideas in the millions, the number of relationships starts to pop up and filter plans based on dates and weights becomes much slower.

As an example, a request to list all ideas used on July 7, 2017 that have votes> 100 takes much longer to complete. To reduce the number of starting points, I moved the Date property to Plan nodes and created new Plan nodes for each type and day. Since this reduces the starting point of the request, it speeds it up. The disadvantage is creating more nodes.

So, I think my question is more design-related as to whether my second approach is what is good practice. I read that using legacy link-based indexing suggests a redesign of the graph, so I wasn't too keen on adding date / weight indexes for relations.

+3


source to share





All Articles