Gremlin vs Cypher Initial Thoughts @Neo4j
Romiko Derbynew writes:
The Neo4jClient now supports Cypher as a query language with Neo4j. However I noticed the following:
- Simple graph traversals are much more efficient when using Gremlin
- Queries in Gremlin are 30-50% faster for simple traversals
- Cypher is ideal for complex traversals where back tracking is required
- Cypher is our choice of query language for reporting
- Gremlin is our choice of query language for simple traversals where projections are not required
- Cypher has intrinsic table projection model, where Gremlins table projection model relies on AS steps which can be cumbersome when backtracking e.g. Back(), As() and _CopySplit, where cypher is just comma separated matches
- Cypher is much better suited for outer joins than Gremlin, to achieve similar results in gremlin requires parallel querying with CopySplit.
- Gremlin is ideal when you need to retrieve very simple data structures
- Table projection in gremlin can be very powerful, however outer joins can be very verbose
So in a nutshell, we like to use Cypher when we need tabular data back from Neo4j and is especially useful in outer joins.
Excellent comparison of Gremlin vs. Cypher. Both have their advantages.