Note that there are some explanatory texts on larger screens.

plurals
  1. PONeo4j Key-Value List recommended implementation
    text
    copied!<p>I've been using Neo4j for a little while now and have an app up and running using Neo4j, its all working really well and Neo4j has been really cool at solving this problem, but I now need to extend the app and having been trying to impl. a Key-Value List of data into Neo4j and I'm not sure the best way to go about it.</p> <p>I have a List, the list is around 7 million elements in length and so a bit long for just storing the whole list in memory and managing it myself. I tested this and it would consume 3Gb.</p> <p>My choices are either:</p> <ul> <li>(a) Neo4j is just the wrong tool for the job and I should use an actual key-value data store. A little adverse to do this as I'd have to introduce another data store just for this list of data.</li> <li>(b) Use Neo4j, by creating a node per key-value setting the key and value as properties on the node, but there is no relationship other then having an index to group these nodes together, exposing the key of the key-value as the key on the index.</li> <li>(c) Create a single node and hold all key-values as properties, this feels wrong, because when getting the node it will load the whole thing into memory, then I'd have to search the properties for the one I'm interested in, and I might as well manage the List myself.</li> <li>(d) The key is a two part key that actually points to two nodes, so create a relationship and set the value as a property on the relationship. I started down this path, but when it came to doing a lookup for a specific key/value it's not simple and fast, so backed away from this.</li> </ul> <p>Either options 'a' or 'b' feel the way to go.<br> Any advice would be appreciated. </p> <p>Example scenario</p> <p>We have Node A and Node B which has a relationship between the two Nodes. The nodes all have a property of 'foo', with foo having some value. In this example node A has foo=X and Node B has foo=Y</p> <p>We then have this list of K/Vs. One of those K/V is Key:X+Y=Value:Z So, the original idea was to create another relationship between Node A and Node B and store a property on the relationship holding Z. Then create an index on 'foo' and a relationship idx on the new relationship.</p> <p>When given Key X+Y get the value. Lookup logic would be get Node A (from X) and Node B (from y), then walk through Node A relationships to Node B lookup for this new relationship type. While this will work, I do not like the fact I have to lookup through all relationships to/from the nodes looking for a specific type this is inefficient. Especially if there are many relationships of different types.</p> <p>So the conclusion to go with options 'A' or 'B', or I'm trying to do something impractical with Neo.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload