0
votes

I have this Cypher query to return the outgoing and incoming relationships of a certain type, for a certain node.

MATCH (n)-[r:INPUTWITH]-(m)
WHERE n.personid='12345'
RETURN m.personid, r.relid
LIMIT 5

It should be very simple query. However, it takes ~30seconds, for reason I don't understand.

I'm using Neo4J 2.0. I created an index on "personid" like this:

Label personLabel = DynamicLabel.label( "Person" );

BatchInserter inserter = inserter.createDeferredSchemaIndex( personLabel ).on( "personid" ).create();

Any ideas what's happening???

1
You are not using the label index, try MATCH (n:Person)-[r:INPUTWITH]-(m) and post back if that makes it any betterjjaderberg
fixed it. Thanks. sorry , such a stupid problem.Imme22009
@jjaderberg, that should be an answer.Johan
@Johan, ok, made an answer of it.jjaderberg

1 Answers

2
votes

To use a label index in a cypher query you must include the label in the query pattern, like so

MATCH (n:Person)-[r:INPUTWITH]-(m)