> Cypher: > > START n=node:words(w_id = "137") MATCH n-[:CO_S]->m, n-[:CO_S]-> t, > m-[r:CO_S]-> t return m.w_id, t.w_id, r.sig, r.freq > > > The results are the same, but the Cypher Query is about 10 times slower > than the SQL pendant. I currently do not use any additional indices. > Just a map ("words") between my word ID and the neo4j node id.
Doing index lookups is much slower than node lookups. In the application I'm developing, we've removed most index lookups and replaced them with node lookups. We keep a keyword to nodeId mapping in a key/value store and lookup the nodeId before running any Cypher queries. In your case: START n=node(1) MATCH n-[:CO_S]->m, n-[:CO_S]-> t, m-[r:CO_S]-> t return m.w_id, t.w_id, r.sig, r.freq (where 1 is the corresponding nodeId to w_id = "137") If I understood your email correctly, you already have that map available to you ("137" -> 1). I'd use that to see if it's any quicker. Your mileage may vary, of course. In our application the speed improvements were roughly 10x. See my post on the mailing list with subject: Comparing Lucene index lookup performance to lookup by node id -TPP _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user