all below is using the legis-graph dataset available on Neo4j sandbox
Below are two queries that have tradeoffs between db hits and rows returned after each output. To reduce cardinality, it seems that the first query is more efficient. However, in terms of db hits, it seems the latter is more efficient. How does one decide which is most performant as the graph grows? That being said, it does seem that we should optimize for database hits, but I wanted to make sure that's the case
query 1
MATCH (b:Bill {billID:"hr1020-114"})
with b, [(b)<-[:VOTED_ON]-(v:Legislator) | v] as voters, [(b)-[:SPONSORED_BY]->(s:Legislator) | s] as sponsors
return b, voters, sponsors
query 2:
MATCH (b:Bill {billID:"hr1020-114"})
with b
MATCH p=(:Legislator)-[:VOTED_ON]->(b)-[:SPONSORED_BY]->(:Legislator)
return p
Also, if I'm not mistaken, it seems that the Expand(All) operation is an eager operator. Is it possible to rewrite the query without this eager operator?
Is there somewhere that lists what the various colors in the execution plan mean: light blue, dark blue, very dark blue? I dont see a description of why particular operations are light blue, blue and a darker blue (which is eager operator) much anywhere. In the same way that an Expand(All) is eager, a CartesianProduct is too, right?