neo4j cypher Match command concatenation -


are these 2 chypher statements identical:

//first match (a)-[r]->(b),b-[r2]->c  //second match (a)-[r]->(b) match b-[r2]->c 

the 2 cypher statements not identical. can show using profile command, shows how cypher engine perform query.

in following examples, queries end return a, c, since cannot have bare match clause.

as can see, first query has not(r == r2) filter second query not. because cypher makes sure result of single match clause not contain duplicate relationships.

  1. first query

    profile match (a)-[r]->(b),b-[r2]->c return a,c; ==> +-----------------------------------------------+ ==> |                     | c                     | ==> +-----------------------------------------------+ ==> | node[1]{name:"world"} | node[0]{name:"world"} | ==> +-----------------------------------------------+ ==> 1 row ==> 2 ms ==>  ==> compiler cypher 2.3 ==>  ==> planner cost ==>  ==> runtime interpreted ==>  ==> projection ==>   | ==>   +filter ==>     | ==>     +expand(all)(0) ==>       | ==>       +expand(all)(1) ==>         | ==>         +allnodesscan ==>  ==> +----------------+---------------+------+--------+----------------+----------------+ ==> |       operator | estimatedrows | rows | dbhits |    identifiers |          other | ==> +----------------+---------------+------+--------+----------------+----------------+ ==> |     projection |             1 |    1 |      0 | a, b, c, r, r2 |           a; c | ==> |         filter |             1 |    1 |      0 | a, b, c, r, r2 |   not(r == r2) | ==> | expand(all)(0) |             1 |    2 |      4 | a, b, c, r, r2 | (b)-[r2:]->(c) | ==> | expand(all)(1) |             2 |    2 |      8 |        a, b, r |  (b)<-[r:]-(a) | ==> |   allnodesscan |             6 |    6 |      7 |              b |                | ==> +----------------+---------------+------+--------+----------------+----------------+ ==>  
  2. second query

    profile match (a)-[r]->(b) match b-[r2]->c return a,c; ==> +-----------------------------------------------+ ==> |                     | c                     | ==> +-----------------------------------------------+ ==> | node[1]{name:"world"} | node[1]{name:"world"} | ==> | node[1]{name:"world"} | node[0]{name:"world"} | ==> +-----------------------------------------------+ ==> 2 rows ==> 2 ms ==>  ==> compiler cypher 2.3 ==>  ==> planner cost ==>  ==> runtime interpreted ==>  ==> projection ==>   | ==>   +expand(all)(0) ==>     | ==>     +expand(all)(1) ==>       | ==>       +allnodesscan ==>  ==> +----------------+---------------+------+--------+----------------+----------------+ ==> |       operator | estimatedrows | rows | dbhits |    identifiers |          other | ==> +----------------+---------------+------+--------+----------------+----------------+ ==> |     projection |             1 |    2 |      0 | a, b, c, r, r2 |           a; c | ==> | expand(all)(0) |             1 |    2 |      4 | a, b, c, r, r2 | (b)-[r2:]->(c) | ==> | expand(all)(1) |             2 |    2 |      8 |        a, b, r |  (b)<-[r:]-(a) | ==> |   allnodesscan |             6 |    6 |      7 |              b |                | ==> +----------------+---------------+------+--------+----------------+----------------+ 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -