Frage

I have a tree with 80,000 nodes and 4M leafs. The leafs are assigned to the tree nodes by 29M relations. In fact i have around 4 trees where the leafs are assigned to different nodes but that does not matter.

After about 6 days of work i figured out how to import such amount of data into neo4j within acceptable time and a lot of cases (csv import neo4j 2.1) where the neo4j process stuck at 100% and does not seem to do anything. I'm now creating the database with this tool: https://github.com/jexp/batch-import/tree/20 which is VERY fast!

Now i finally got my database and started with a simple query like "how many leafs has a specific node":

MATCH (n:Node {id:123})-[:ASSIGNED]-(l:Leaf) RETURN COUNT(l);

i created an index on the "id" property but still this query takes 52 seconds. It seems like the relation (without propertys) is not indexed at all... Is there a way to make this faster?

War es hilfreich?

Lösung

The relationships don't have to be indexed.

Did you create an index like this:

create index on :Node(id);

I recommend that you add a direction to your arrow otherwise you will follow all relationship up and down the tree.

MATCH (n:Node {id:123})<-[:ASSIGNED]-(l:Leaf) RETURN COUNT(l);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top