Hey,

I'm currently converting some SQL Queries to Cypher and I'm very happy 
to see what is possible with the language.
I was wondering if the following query can be optimized, it selects the 
edges between neighbours of a given node (137) who also know each other:

SQL:
select w1.w1_id,w1.w2_id,w1.freq,w1.sig from co_s w1
where
     w1.w1_id in (select w2.w2_id from co_s w2 where w2.w1_id=137)
and
     w1.w2_id in (select w3.w2_id from co_s w3 where w3.w1_id=137);

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.

Thx for your help! Great work! Rock on!

Martin (@kc1s)
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to