Michael, Including the label in the relationship's target, makes the cypher query run faster, but a count with just the relationship is taking 496ms, it looks too much.
1. neo4j-sh (?)$ MATCH (n:`label1`)-[r1:rel1]->(n1:`label2`) RETURN COUNT(n); 2. +----------+ 3. | COUNT(n) | 4. +----------+ 5. | 462059 | 6. +----------+ 7. 1 row 8. 496 ms El miércoles, 20 de abril de 2016, 3:57:47 (UTC-3), Michael Hunger escribió: > > Double Negation ? > r1 is never null > Add a label to n1 > Use a Union > Look at the query plan with profile > > Try this: > > > MATCH (n:`label1`:`label2`) WHERE size( (n)-[:rel1]->() ) = 0 > RETURN COUNT(n) AS count; > UNION > MATCH (n:`label1`:`label2`)-[r1:rel1]->(n1:Label3) WHERE n1.`name` IN > ["name1","name2"] > RETURN COUNT(n) AS count; > > > On Wed, Apr 20, 2016 at 12:41 AM, <[email protected] <javascript:>> > wrote: > >> I'm using Neo4j 2.3.3. >> >> The query is very simple: >> >> neo4j-sh (?)$ MATCH (n:`label1`:`label2`), n-[r1:rel1]->n1 WHERE >> (n1.`name` IN ["name1","name2"] OR NOT(r1 IS NOT NULL)) RETURN COUNT(n) AS >> count; >> +--------+ >> | count | >> +--------+ >> | 462059 | >> +--------+ >> 1 row >> 2894 ms >> >> >> Any ideas on how to improve it? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Neo4j" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
